-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the install scheme to posix_prefix
when --prefix
is passed
#10978
Comments
What is the behaviour of the distutils backend? |
If this behaviour originates due to a Debian patch, it is usually a good idea to file an issue with them. Please file a bug with Debian, with |
They are different: >>> from pip._internal.locations import _distutils, _sysconfig
>>> _sysconfig.get_scheme('click', prefix='myprefix').purelib
'myprefix/local/lib/python3.10/dist-packages'
>>> _distutils.get_scheme('click', prefix='myprefix').purelib
'myprefix/lib/python3.10/site-packages'
Thanks for the guidance but I am not able to do so now(some problem with |
Hmm yeah at least they should match. I don’t think Debian can handle this though; the |
I'm seeing a similar problem on Fedora 37 (Rawhide) while trying to package a Python module (see Cantera/cantera#1233), using both the Fedora-packaged version of pip or pip installed from PyPI, so I don't think that this is only a Debian problem. In both cases this is using pip 22.0.4. There are some differences, though, compared to the behavior reported on Debian -- I see the >>> from pip._internal.locations import _distutils, _sysconfig
>>> _sysconfig.get_scheme('click', prefix='myprefix').purelib
'myprefix/local/lib/python3.10/site-packages'
>>> _distutils.get_scheme('click', prefix='myprefix').purelib
'myprefix/local/lib/python3.10/site-packages' |
If it's injected for both implementations, this is not a bug but an intended behaviour. You need to check with Red Hat to understand their intention behind this and resolve the issue there, pip cannot change it here. |
Not to disrupt the conversation, but isn't the prefix install scheme fairly-explicitly specified in https://docs.python.org/3/install/index.html#alternate-installation-unix-the-prefix-scheme? Is this behavior changing, and is that documented somewhere? |
It’s not the install prefix that’s the problem, but Debian changes how it uses the install prefix, and we need their confirmation why they changed one place but not the other (and if one of them is wrong, which is the right one). |
FWIW, Fedora also has a similarly breaking patch (https://github.com/fedora-python/cpython/blob/f52f499bb9ac03d7793fa2e1ccaaab8a3169685e/Lib/sysconfig.py#L77) and they directly modify I suggest we move further discussion to https://discuss.python.org/t/18240, mostly because that's a better forum for the sort of cross-project discussion that this is gonna need. |
To avoid having to deal with the setup.py install vagueries when installing python for Debian packaging, let pybuild take care of the building and installing of python. Rewrite debian/rules to make use of debhelper for as much as possible and minimize hackery. Also remove Debian-packaging-specific hacks in Makefile.in The recipe we are now following is to install everything in debian/tmp (instead of straight into the debian/<package>/ directories), and divide the resulting files up over the packages using debian/<package.install> files. Try to clean up some Lintin errors and warnings in the process. Note that we are still using distutils in the setup.py files and calling "python setup.py install" which are both deprecated. Only this combination appears to not be hit by pypa/pip#10978 so just leaving as is. Also introduces: * testing on both Focal and Jammy * fix intermittent test failure in build process
Not sure if I'm misunderstanding the issue description but for me it seems to have a different/the opposite behavior with regards to site/dist-packages. Installing a Python package using This was tested on Debian Buster as well as Debian Bullseye which has
|
Using the `--prefix` argument is broken with newer pip versions and at least Python 3.10. The distros are patching CPython's sysconfig module which breaks our `--prefix` argument expected behavior. Because the default is install prefix is already `/usr/local` we just can remove the `--prefix` argument to circumvent the bug. See the following links for details: * pypa/pip#11651 * pypa/pip#10978 * https://discuss.python.org/t/linux-distro-patches-to-sysconfig-are-changing-pip-install-prefix-outside-virtual-environments/18240
Using the `--prefix` argument is broken with newer pip versions and at least Python 3.10. The distros are patching CPython's sysconfig module which breaks our expected behavior if the `--prefix` argument . Because the default install prefix is already `/usr/local` we just can remove the `--prefix` argument to circumvent the bug. See the following links for details: * pypa/pip#11651 * pypa/pip#10978 * https://discuss.python.org/t/linux-distro-patches-to-sysconfig-are-changing-pip-install-prefix-outside-virtual-environments/18240
Using the `--prefix` argument is broken with newer pip versions and at least Python 3.10. The distros are patching CPython's sysconfig module which breaks our expected behavior if the `--prefix` argument . Because the default install prefix is already `/usr/local` we just can remove the `--prefix` argument to circumvent the bug. See the following links for details: * pypa/pip#11651 * pypa/pip#10978 * https://discuss.python.org/t/linux-distro-patches-to-sysconfig-are-changing-pip-install-prefix-outside-virtual-environments/18240
The corresponding Debian bug report is https://bugs.debian.org/1035546 . Perhaps you can edit the description to make it easier to find? Thanks! |
1. Need to work around pypa/pip#10978 - This issue was preventing the use pip install to install the wheel because there was no way to remove local/ from the prefix but the problem seems to only be on debian-based systems so working around it would be difficult 2. The solution is that now cmakeme extracts the wheel manually and installs it to the proper location. Advantages to this approach: 1. There is no dependency on pip being installed. Instead the whl is just a zip archive which can be extracted with a cmake -E command 2. Hacks related to finding the full wheel name are no longer needed because the wheel is extracted at build time instead of compile time 3. Installation is cleaner (from a cmake code perspective) because it is just copying the extracted wheel to the proper directory. Disadvantage 1. Essentially, this is cmake simulating a wheel install by unzipping. pip might be doing some other steps, and I'm not sure what they are and there might be packages where the approach here does not deal with all cases, and I might not even be always putting things in the correct directory 2. However, the main goal is for it to be in a directory that ROS code can find things.
Calling `make install` fails when specifying /usr as prefix, because of pypa/pip#10978.
Because of pypa/pip#10978, `make install` is currently unable to install the Python code to a custom prefix (PREFIX).
Because of pypa/pip#10978, `make install` is currently unable to install the Python code to a custom prefix (PREFIX).
Because of pypa/pip#10978, `make install` is currently unable to install the Python code to a custom prefix (PREFIX).
Because of pypa/pip#10978, `make install` is currently unable to install the Python code to a custom prefix (PREFIX).
Because of pypa/pip#10978, `make install` is currently unable to install the Python code to a custom prefix (PREFIX).
What's the problem this feature will solve?
On Debian systems, due to the sysconfig patch,
sysconfig.get_preferred_scheme('prefix')
will returnposix_local
, which is also the default scheme. This causes problem when using--prefix <path>
withpip install
, where packages are installed to<prefix_path>/local/lib/pythonX.Y/dist-packages
. This is apparently wrong.Describe the solution you'd like
Add a special case to
pip._internal.locations._sysconfig:get_scheme()
, whenposix_local
is found inINSTALL_SCHEMES
andprefix
is not None, rewrite the scheme asposix_prefix
.Alternative Solutions
I am not sure if it is better to report it to Debian, but IMO it makes more sense to fix it in
pip
to be more robust.Additional context
Code of Conduct
The text was updated successfully, but these errors were encountered: