-
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
pip should respect /usr/local #5722
Comments
Same as #1668. |
No. #1668 suggest that pip should default to |
Ah, Sorry. I linked the wrong issue: #5605. |
Also not the same. This is a solution to that issue but it's not a duplicate. #5605 says we shouldn't upgrade the packages installed by distro's package manager, this issue says we shouldn't write to Here's a really boiled down overview of the Filesystem Hierarchy Standard (FHS): |
IIUC, distributions can use pip itself when performing the packaging for their package manager, so being able to write to /usr/lib is something we'd want to allow doing -- it shouldn't be the default (which it is currently, both the above issues work toward changing that and improving behavior in this regard). None the less, I'm a little short on time to look further into this right now. Sorry! |
(From memory, I'm also short of time right now) What we write to is basically what Python tells us (via sysconfig) the "right location" is. So if a distribution doesn't want us to write to Pip never explicitly refers to |
@pradyunsg yes they can but is extremely discouraged, at least in Arch Linux. I don't see any harm in allowing this if it's explicitly indicated. @pfmoore I looked into it and according to the documentation |
@FFY00 Yes, basically this is largely around "how Python works". I don't honestly know the history, but it's probably based on the original design of distutils, if not even older than that. There's a single site-packages location, which is (somewhat) special, even though you can put other directories on
Yes, but tools (like pip) typically get the install scheme via |
I am a packager for Arch Linux. In Arch we try to patch software the less possible and this, however an issue, it's not that critical.
I will draft an email to send to the mailing list. If someone has any proposal on how to handle this issue, please let me know. If anyone wants to contact me they can do so at lains@archlinux.org. |
Cool - thanks for clarifying the context (I suspected you might be asking on behalf of a distribution, but wasn't sure). I'm not a Linux user, so I don't know the constraints/options involved, but I'd certainly support having a more flexible approach to the whole question of where things get installed. I do think it's important in a wider context than just pip, so your approach sounds good. Maybe starting on distutils-sig (which is where most of the people with a direct interest in packaging hang out) would be better than going straight to python-dev - having consensus from that list would likely make it much easier to get agreement on any changes needed in core Python (as well as giving people a chance to explore options that might help with existing Python versions - anything python-dev agree to is unlikely to affect Python versions prior to 3.8). |
Well, I am not officially asking on behalf of the distribution, I am just interested in getting this fixed 😄. Thank you for your suggestion, I'll contact |
Debian has 2 patches of relevance, there's the At some point I'd love to get that patch upstreamed, but I haven't found the time for it. |
@dstufft so you're in favour of pip special-casing a return of |
No, I agree with what you said. Pip asks Python to tell it where to install, if we want to change that we should change Python itself (I'm ~fine with backporting shims to try and get more consistent behavior between 3.NEW and old versions). I was just clarifying that Debian has two patches to Python itself, one for the |
@dstufft where can I find the patches? If the |
https://bazaar.launchpad.net/~doko/python/pkg3.5-debian/view/head:/patches/distutils-install-layout.diff This one I think, although there might be other patches in that directory that are required as well. |
Thank you. I am not sure on out to approach this issue. We could patch |
@FFY00, did you arrive at a solution for this? |
We're going to take a different direction with PEP 668 (https://python.github.io/peps/pep-0668/). Is this still relevant with that? |
It's not. In fact, I no longer think that using |
What's the problem this feature will solve?
pip
breaking system dependencies on Linux. Right now, users who want to respect the os dependencies need to install packages as user or need to use separated environments. This is obviously not optimal. We should be able to runpip
without breaking the system out of the box.Describe the solution you'd like
The solution is quite simple, just make
pip
respect/usr/local
.pip
shouldn't touch/usr/lib
since that directory is supposed to be used by the distribution.pip
should install its packages to/usr/local/lib
.However, I don't know what would be the best way to add
/usr/local/lib/...
to thePYTHONPATH
. I think there's a section in python config that allows us to do that. If not, we could try to submit a PEP.Alternative Solutions
As I mentioned before, those would be installing as user (
--user
) or using a pyenv.The text was updated successfully, but these errors were encountered: