-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
Adding an option to allow pip-compile to accept conflicts #561
Comments
Hi @twig, This is actually a normal behaviour: By installing I hope that makes sense. |
Wow you responded much quicker than expected. Feels rather frustrating that there isn't an override of some sort though as bringing more libraries over to |
You might be interested to know that Now, about that override option, let me present it this way: by overriding the version of There are cases where it could be ok, but in most cases, it comes down to having packages defining the right requirements constraints for their use cases instead. A lib strictly pinning some of its dependencies should have a really good reason for doing so. |
Ahh yes, I came across that when playing with pip-tools earlier. I chose it because v2.0.0 was such a simple example to reproduce. Hmm I agree with you on the explicit versioning for a reason, but for libraries which have been abandoned or are very slow moving (pyrax for example), |
Actually, scrap that. I just realised our old It would probably be worth noting in the docs as well I suppose. |
Explicitly pinning versions in a library is obviously not desired. But the world is dark and full of terrors: either a library is not well maintained, or it needs to pin a dependency to a specific version due to monkey-patching, or any other exotic or not-so-exotic reason. This is probably why for the above example:
while
I agree that raising an error by default makes sense, I'd prefer if |
By default we get an error if there is version conflict, e.g.: "Could not find a version that matches requests==2.18.4,==2.7.0" With this option the constraints defined in the spec file (requirements.in) take precedence, so the installation can continue, and a warning is printed, e.g.: "Conflicting versions found: requests==2.18.4,==2.7.0, using our constraints: requests==2.18.4" This makes behavior similar to ``pip`` and is a workaround when libraries are too strict in specifying their dependencies.
Here is a quick proof-of-concept how this could work. Example
Default behavior (unchanged):
With the
Would be nice if we included a comment in requirements.txt, that Thoughts? |
First @jcerjak, thanks for the PoC. If I get this right, the idea in your PoC is that when getting a conflict, with The idea makes some sense as it's similar to the way But, here are my concerns. First, the technical concerns:
Beyond that, my main concern is this: This option allows users to easily create a
I believe those dependencies conflicts should be addressed at the lib level, rather than making it easier to ignore the problems. I believe that lib maintainers should be encouraged to be thoughtful on their dependencies constraints, and adopt good practice that are future-proof (ex: leave the pinning and downpining to the app level, give leeway). If a lib is slow-moving, then I would highly suggest that the maintainers avoid adding tight constraints that will be a pain to users. For the abandoned lib, that's a shame, and that falls in the list of consequences of un-maintained libs. So, in my opinion, this would hurt more than it would help down the line. I do not see this as an harmless option that will help some users, I see this as opposed to what Now, this is my take on this. This is an open-source and Jazzband project. Anyone who disagrees with my vision is strongly encouraged to say so. If this is a widely desired option, then OK, I'm not here to impose my vision on everyone. I'm acting as Lead, not Boss. |
Thanks @vphilippon for a timely and thorough response. I do agree that ideally this should be addressed at the lib level, though sometimes you want to have an override switch to get things done. But I understand that adding this would add more complexity and maintenance burden and is also not in line with the concept of So I'll probably go with the approach of creating a fresh virtualenv + pip freeze for now. Thanks! |
Actually, I'm mainly pip-tools to help keep reference of why libraries are in my requirements.txt in the first place. The auto-generated file includes comments which are very helpful in debugging why libraries are there, something which regular pip freeze doesn't do. The ability to override when needed would still be highly appreciated! |
Not as nice, but you can manually check why a library was installed with
Check dependencies:
Check which packages require
|
Neat! Sadly not as nice as having it in requirements.txt as pip-tools would have it Just an update, my initial issue was resolved by the library authors at https://github.com/waveaccounting/vero-python/issues/26 But it doesn't really resolve the issue in the case of inactive libraries and such. From memory, npm/yarn has a nice resolution selector when it runs into version conflicts. |
This request looks like a duplicate of #215. |
I've found a related problem via
This causes Playwright works fine with Greenlet 3.0.1 as it has no API changes, and I need that version for Python 3.12 support, but I'm now stuck waiting for Playwright to remove that pin or at least to update it. Even if I forgo 3.12 support, I'll have to pin greenlet in my dependencies — despite it not being a direct dependency — just to get compilation to work:
But how do I know when playwright has removed that pin? If they update it, I'll get a helpful compilation error, but if they remove the pin, I won't know unless I'm specifically reading their release notes or watching relevant GitHub issues.
|
Hi there,
I'm trying out pip-tools in hope of cleaning up my requirements.txt file and quickly found an issue while trying out some examples.
It seems that two levels of version pinning on the same library causes pip-tools to conflict with itself.
Environment Versions
Steps to replicate
virtualenv testpiptools
pip install --upgrade pip
source testpiptools/bin/activate
pip install pip-tools
requests.in
and edit itpip-compile requirements.in
requirements.txt
contains(this is fine so far)
8. add latest version of requests to
requirements.in
9 . error occurs (see below)
Expected result
Actual result
so the problem seems to be requests==2.18.4 cannot also be ==2.7.0 at the same time.
I've read through the documentation on the github page many times and even tried:
Many blogs refer to this as a great tool and I have been itching to try it, but this seems like a rather common issue to run into fairly early.
Is there something missing from a FAQ of which I haven't seen yet?
The text was updated successfully, but these errors were encountered: