-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Support per-requirements overrides (--install-option and --global-option flags) #2208
Comments
It would be helpful to see a use case here, I don't think any of us are eager to make fundamental changes to any parts of the spec. Since you are proposing a change to the pipfile spec you should file an issue against https://github.com/pypa/pipfile For documentation purposes I'd be curious about the use case, but I'm probably going to close this and encourage you to file this against the pipfile repo |
Thanks for the feedback. I run into this issue while installing dd. Providing the same flag directly on the command line or as an environmental variable will fail as it propagates the flag to all dependencies (as documented here). I will file an issue on https://github.com/pypa/pipfile as suggested. |
I'm not sure this is the same issue but I think it is, so here's another (possible) use case that doesn't seem to be supported with current syntax I can find documented: The cleanest way I have found to use system-installed pyqt(5) in a venv is to install vext.pyqt5, which basically installs shims to use the system copy of pyqt5 in the virtual environment. For some reason this package does not play nice when installed from wheel - and I agree this is probably a bug in the package that should be addresssed - so in a classic venv workflow you would install with:
I have confirmed that using this variant of the install command works (on previous pip versions it would apparently have been I have not had any success with this in my Pipfile when I try to initially create an environment using Interestingly: if I leave this out of my Pipfile initially, and then after installing the rest of the environment I use I recognize that in this case it may be addressable by correcting some issue in the vext.pyqt5 package, but I still think it's another argument for adding this kind of argument to the Pipfile spec - and I will add this comment to an issue on the Pipfile repo if/when that happens. Edit: seems that the vext author is aware of this as a (non)-problem since 2016 - vext-python/vext#37 - maybe I should open/reopen the issue there since it now is an issue for pipenv initialization? I didn't want to paste the full error message above because it's long, but here's the relevant part from
|
@techalchemy Any thoughts on this use case? I realize it is an issue with the package, but in my experience there are a number of useful packages out there that require specific pip options to install cleanly so I think there's some utility in having this ability. Also, should I file a separate issue for the fact that the package installs functionally (albeit with apparent error) when using |
Personally I feel at least no-binary should be supported because it is needed quite often. Maybe we can make the option better (use TOML mapping instead of specifying raw pip arguments), but we should have something. |
Do environment variables not work here? |
Aw, yes, now I think of it, |
Is there a way to put environment variables into the pipfile? Specifying them manually doesn't seem like a good solution. It would be extremely easy to forget what set of variables were used and end up with a different install from the same pipfile |
@dmitriyshashkin Good point. Again, we’d probably need to plan this in a more comprehensive way. |
EDIT: Original comment preserved below, but I no longer think the vext.pyqt5 issue is related to installing with --no-binary vs. not. Reasons:
My best analysis at this point suggests two issues: vext.pyqt5 may not be properly declaring dependencies (hence error when not installed using At this point I'm not sure if this merits its own issue. The whole point of the vext system is to selectively break the barrier between venv and system for specific packages, pipenv/Pipfile seem to be the next evolutionary step in environment management, and (this) vext package doesn't play well with the normal install procedures. At this point my options seem to be either -- Original comment--
I admit I was not aware of this option, but unfortunately I just tried it and it does not appear to work in this case. Snippet (using fish)
This is the same output I got before, and while it appears to succeed on the second try it does not result in a functionally installed package (as evidenced by >>>import pyqtgraph failing with a failure to find Qt).
|
I just wanted to add another example of why it's very useful to specify the equivalent of There's an issue right now with the package "hiredis" where a new maintainer joined the project and added binary wheels for a three-year-old release, so the pipfile.lock hashes stopped matching. This is all probably fine and good (and I don't mean to criticize that particular maintainer for being helpful!), but for a while it was unclear whether the binary wheels were legitimate -- and it's still not 100% clear, as the original maintainer is asking people to confirm that the wheels match the source. So while that issue sorts itself out, I would like to keep the original hashes and make sure that hiredis installs from source across all deployments. The pipfile is by far the preferable place to make sure that happens -- doing it otherwise basically requires wrapping pipenv in a custom script. |
One more use case: to install LightGBM with GPU support. Following @numshub's syntax it would look like: |
So it's okay for Say what you will about javascript, but I've never seen anyone have to do As a side node, |
Making a post asking us about whether it’s ok for pipenv to blow up is not very productive. Obviously if a command fails instead of succeeds, as a user, you just had a negative experience. On the other hand, someone needs to actually think about the solution, approach, and implementation and propose that in an enhancement proposal PR to the Consider this: anything we implement now, we will be stuck with forever. We err on the side of not implementing things that have solutions or workarounds unless the UI/UX is sufficiently bad. As a maintainer, I have to pay for poorly thought out implementations in maintenance overhead later |
I intended it more as a rhetorical question to demonstrate that environment variables aren't a viable solution for these issues. If it's required to be set to build successfully, it should be somehow represented in the configuration. |
I did not see an issue in the Pipfile repo to hash out the spec, so I filed: pypa/pipfile#115 My use case: The Protobuf package contains a C++ extension which has a crashing bug. I could work around it by building from |
Here's another use case that I can't specify in the To make The easiest fix is to run |
Here's another use case: This works to install python-ldap on MacOS |
my use case:
so using pipenv to install, expect support something like this:
|
my usecase to install gdal: |
btw, perhaps one way around this is by loading |
my usecase to install dulwich It allows skipping the installation of C bindings by using the |
My use case is installing django-compressor On Windows, django-compressor's dependencies throw Visual C++ extension errors even though the required extensions are installed. Issue: rcssmin and rjsmin do not install These install options allow it to install without c extensions.
Without install options for pipenv, we are forced to use a |
just went through this installing lightgbm with gpu support. |
Any news? |
1 similar comment
Any news? |
Hi 👋 Another use case for this feature would be the ability to statically compile psycopg2. |
You will see in the next |
Unfortunately, that still doesn't seem to provide a way to supply arguments to See: https://pip.pypa.io/en/stable/reference/requirements-file-format/#per-requirement-options |
@rummik Thanks for the explanation. |
@matteius Is there any progress or other way to use the --global-option? |
@bernd-k1337 sorry, I had kind of lost track of this issue -- I see I self assigned it, but perhaps others in the community could take this on -- I was chatting with @CNDW recently, and perhaps this would be of interest to him, or if not, maybe someone else could take it on: if no one gets to it by October (Hacktoberfest) I'll make a bigger push to do something myself. |
I can take a look at this one once I get some free time this week 👍 |
The problem
Since version 7.0 pip allows the usage of --global-option and --install-option individually for each requirement in requirements.txt (https://pip.pypa.io/en/stable/reference/pip_install/#per-requirement-overrides).
It is in principle possible to use environmental variables (PIP_INSTALL_OPTION and PIP_GLOBAL_OPTION), but they are propagated to all dependencies usually ending up in a failed install.
Required feature
Honor the install-option and global-option fields in Pipfile.
Due to the way this is implemented in pip, several space-separated arguments should be tranlasted into multiple --install-option / --global-option flags.
Example
[Pipfile]
...
apackage={version = "*", install-option = "--arg1 --arg2"}
...
[requirements.txt]
...
apackage --install-option="--arg1" --install-option="--arg2"
...
The text was updated successfully, but these errors were encountered: