-
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 install --target --upgrade removes existing packages scripts #8063
Comments
Title edited to improve readability. I hope it is alright. |
As per the docs at https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption-t , providing This can also be observed by not passing the -U flag in the second
So I would say that providing |
@deveshks, the documentation you referred, says
What I can infer is that it would replace existing packages with new versions. Should it remove the existing packages if not specified? |
It seems so from the output. All the files present in |
With
I think the bug here is that in Without target mode it has no problem adding script symlinks to/from a virtualenv's I'd like to be able use |
I have the same issue with python 3.6 and pip 20.1.1. |
@dulfox my workaround for this has been to |
I'm looking for an answer for the broadest possible case : I want to bring as many dependencies on board as I can. |
On a windows system, I define |
Hi, is there any chance to see a fix for this issue in the near future? This behaviour is rather counter-intuitive and I don't really see any easy workaround apart from installing to different targets and merging directories afterwards. |
Same issue here. Is there an option to ramp up the |
And one more data point here. I'm installing my project dependencies first with If I add the |
To be perfectly honest, So for now, I'd say:
If that's not sufficient for you, you need to write something customised for your particular situation. Sorry if this isn't what the people commenting on this issue want to hear, but I'd rather set expectations clearly than leave people thinking that this will be "fixed" at some point and trying to struggle on in the meantime. |
Thank you for your answer @pfmoore.
Not sure about the docs, but the warning is definitely suggesting to use the upgrade option with the target one. Maybe this can be rephrased? -WARNING: Target directory /path/to/target/namespace already exists. Specify --upgrade to force replacement.
+WARNING: Target directory /path/to/target/namespace already exists. Specify --upgrade to force replacement (existing 'namespace' will be replaced completely, not merged)
It won't do for my use-case ^^ but for others maybe 🙂
Of course, that's perfectly understandable, thank you for making it clear. |
The thread says not to use '--upgrade' with '--target', and that is ok. But without it, if 2 different modules install into /bin, only the 1st will put its executables there. As far as I can tell there is no way withy '--target' to install 2 different modules that both expect to put their files in the bin dir. That makes --target have a very limited use |
Sorry, but... is this for real? How is one supposed to install packages whose dependencies also need to be installed into the same namespace? Try to install The |
We also need it for our use case where we install packages that have the same shared/common directory (i.e. namespace). For example, Repro steps on a Windows machine: Then, look into the zope directory here: If
Do you suggest any workaround for us? |
I'm currently testing if there are any issues with my solution, but in case anyone else is on Windows and willing to try, you could use a directory junction from the default pip installation folder to a custom folder (instead of setting this custom folder via "--target"). |
Essentially there is no support at all for a non-standard pip installation directory? All I want is for 'site-packages' and bin to be stored in another location, without overriding each other and without having to sym link it? Another link on the same issue with a proposed solution. |
I found that with regards to #10629 this message about target directory already existing appears to be related to the fact that pip usually installs to two different folders. A platform library directory (e.g. lib64) and a standard library directory (e.g. lib). The issue is around that some packages go into one and others into the other, and it can create a conflict when trying to copy them to a single directory, since the installation process has already "split" them across two locations. Not sure if this is the same process happening for bin (since the above is for lib) but maybe it is. Seems |
I managed to workaround it by using virtualenv and just copying out from the lib folder. It appears that virtualenv just symlinks lib64 to the lib folder. Maybe pip could do something similar when target_dir is specific (I did a quick test and it does seem it works fine... just I have no idea how to properly handle Windows :) ) |
The only really supported use case for The structure of the directory created by If you want a directory structure that matches a Python installation, and therefore should support upgrades, etc, then |
@pfmoore I think there's two issues in this issue, and maybe I've polluted it a bit, sorry.
|
@driskell Correct, as I say, the expected use case (or at least my expectation) is that you don't do (1), you delete the directory and reinstall everything. As for (2), that's #10629, as you said, and I don't really know the right answer for that one, as I don't do much on systems that have purelib != platlib, so I don't have a good intuition on what that should do (or even why having purelib != platlib is a reasonable thing to have at all...). So I'll leave #10629 for someone else to investigate. |
@pfmoore the following command fits to what you describe to be a valid/supported use-case:
E.g. run just once and no upgrades. Yet, this package (naturally) pulls its dependencies, one of them being
The installation to a standard location (or virtualenv), e.g. without |
Hmm, OK so I suspect there's a bug with |
Environment
Description
pip with
-t
removed other file in target bin folderExpected behavior
when install package
ipython
should not remove packagepylint
bin filesHow to Reproduce
Output
After install ipython, pylint is deleted.
The text was updated successfully, but these errors were encountered: