-
Notifications
You must be signed in to change notification settings - Fork 290
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
4.2 re-orders requirements.txt before installing, breaking extra pypi index #236
Comments
Thanks for the bug report @vickeryj! @AndrewFarley, any chance you could take a look at this since you implemented the majority of the changes that make up 4.2.0? |
@dschep Absolutely, I totally can see the bug. I know exactly what will do it. Give me a few minutes to get setup on my laptop and I'll get you a MR shortly. |
@vickeryj Can you please try my MR?
Please note: you will need to change your requirements.txt file to be...
So, as far as I can tell, the requirement.txt format guide says that all internal options should be prefixed with -- and only at the start of the file, because all "normal" lines (packages to install) may optionally use single line prefix switches (eg -e). I think this is why pip and your config is getting confused. I'm using this logic to "skip" re-ordering any lines that are prefixed with --. In fact, with the above modification to your requirements file you may not even need my branch (please try to confirm). But, I would still like to preserve their order just incase this changes in the future. And just so you know, this re-ordering/sorting logic is in place so we can detect duplicate requirements.txt files that may contain different comments, or ordering of packages but still actually mean the same thing because the order of packages in a requirements file doesn't matter. It makes sense to skip trying to order these header/options type commands since pip requires them to be at the top, however, you would hope/assume that pip would not care about their order, eh? Honestly, this seems like a pip bug. Bug anyways, try my slight modification mentioned above on the branch I specified above and see if that fixes it for you and let me know. Oh and sorry I couldn't get around to it yesterday! :( Ran out of time, needed to sleep |
Thanks for the quick turn around @AndrewFarley! |
No problem, I fully expect a few tweaks/bugs here and there since it was a rather large change. I'll do my best for quick turnaround, help keep everyone working happily. |
This works well, thanks! |
Hi @AndrewFarley I'm still seeing this reordering behaviour in the latest release (4.2.1) after this fix. I have a Pipfile and when I (or the plugin) run
but after reordering it gets changed to
which fails for the same reason as above. Changing to This feels like the same issue but happy to open a new one if this isn't the right place. |
@paddycarey Definitely the same/similar error... you can fix this right now by changing Side-note, I'm going to go ahead and add -i and -f to the ignore list, found a good link to all header/options... https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format |
@paddycarey Can you please try the following, in the MR linked above which hopefully @dschep can quick review/merge/release as well to help prevent this from happening to anyone else.
|
@AndrewFarley not sure that is entirely true, correct me if wrong; https://pip.pypa.io/en/stable/reference/pip_install/#installation-order I had a requirements file like so;
With Once reordered, django-otp having a dependency of Django>3.0, this later version of Django will now be installed.
Solved this by listing |
So maybe we need to discuss altering the logic I created that reorders the requirements file. For a little background information, that was created so that repos that used the same requirements but possibly in a different order would be considered the same and would use the same cache. Removing this logic honestly would probably solve a few problems, maybe it was just a little too ambitious. I’d love to hear if any of the other contributors or maintainers has any objections to that. I think I’ve seen quite a bit of pain because of this. Anyone care to make a case to keep the existing logic? |
I’ll kick out a quick PR for this and I honestly think this will solve a handful of our users problems and open issues that relate to this. @brett-matthews thoughts? |
@AndrewFarley understand why you put reordering in there. Just thought I should share my experience for others to stumble across if they had a similar problem. Explicitly adding Django solved it for me : ) |
@brett-matthews I suspect it only solved your problem because in your case the circular dependency you ran into happened to be solved with them in alphabetical order. If it wouldn’t have been there would be no way in which you could make it work. Which seems to be what I see some people encounter in other issues. |
ah yes you are right! this may block other people depending on how lucky you are with your dependency's name.. |
PR: #481 |
thank you @AndrewFarley! |
We have some packages in a secondary pypi server so our requirements.txt looks something like:
A recent change this package to
pip.js
seems to re-order this:https://github.com/UnitedIncome/serverless-python-requirements/blob/master/lib/pip.js#L287
to
Now, this works fine with pip install, but when serverless tries to install with this file it can't find anything in the repo.fury.io index.
The text was updated successfully, but these errors were encountered: