-
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
When --python option is placed after the subcommand name in pip install, it gets ignored #12067
Comments
Sorry, user error. I realized that the But I think it's still misleading for pip to silently ignore the |
This sounds like a bug. I would expect the global I don't know how best to fix this. One option is to simply document the behaviour (and if you have any suggestions on how we could do that in a way that would have helped you understand what was going on here, that would be great). Or we could raise an error if I've retitled this issue to reflect the actual problem here. Footnotes
|
The outlined solution doesn't work because the initial parse stops (by design) when it encounters the subcommand name. So I think the best we can do is warn (or error?) when the |
Thanks for the quick reply! I agree that if it's difficult to fix, then at least adding a warning is a reasonable short-term step to take, since silently ignoring is definitely not good.
Yes, I think it would also be reasonable to add some text to the documentation to describe the limitation in addition to printing a warning. Here is my attempt at wording it:
Feel free to take, adapt, or ignore that suggestion as you like. |
Description
Apologies if this is a duplicate issue, but I cannot for the life of me figure out how to use either GitHub or Google's search to search for the string "--python", since they either ignore the
--
or treat it as a negative search, and the string "python" is obviously not specific enough to identify just the CLI option.From reading the documentation on the
--python
option, it sounds like it exactly matches my use case of wanting to use pip to install a package into a different virtual environment. However, the commands in the example code block on that page don't work for me when I try to use a pip that was itself installed into a different virtual environment, since instead of installing to the virtual environment pointed to by the--python
option, it installs to the virtual environment that pip itself is installed to.I can't use the pip that is bundled with my python installation, since that version of pip is too old (22.2.1) to have the
--python
option. In my environment, we are running RHEL 8.7, but we are using a version of Python 3.10.6 that was compiled from source, and we cannot upgrade the version of pip that we installed at the time for reproducibility reasons. For all intents and purposes, you can treat this Python and pip as part of the "system", even if they were not packaged by Red Hat.My use case is that I would like the ability to create minimal virtual environments that don't have pip installed and still be able to tell a separate installation of pip to install packages into that virtual environment. Since my "system" pip is too old to have the
--python
option, I would like to use a pip that was installed in one virtual environment to install packages into a different virtual environment.Expected behavior
I expected that the packages would be installed to the virtual environment pointed to by the
--python
option, not the virtual environment thatpip
itself is installed to. I would also at least expect a warning message if it is just going to ignore the--python
CLI option.pip version
23.1.2
Python version
3.10.6
OS
RHEL 8.7
How to Reproduce
Output
Code of Conduct
The text was updated successfully, but these errors were encountered: