Skip to content
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

specifying an order of install with requirements.txt #2362

Closed
tisdall opened this issue Jan 16, 2015 · 13 comments
Closed

specifying an order of install with requirements.txt #2362

tisdall opened this issue Jan 16, 2015 · 13 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@tisdall
Copy link

tisdall commented Jan 16, 2015

My issue is specifically with using Cython. Several packages I have make use of Cython to compile package components only if it's available. If the package isn't available it uses a pure-python approach. So, I'd like to make sure Cython is installed first before those other packages so it properly compiles C extensions.

I saw another issue related to this but it was specifically talking about utilizing order to fix dependency issues. This issue is when it's a package that's not a dependency but if it exists it's utilized.

I stuck Cython at the top of the list but it seems to actually have installed it dead last instead of first. I notice that the order of install was opposite of the order of the file, so I then stuck Cython at the bottom and it seems to be the second one to be installed. It seems like if packages have no interdependencies it should install them in the order they're found in the file (and not reverse order).

@risingmoon
Copy link

This has bothered me for some time. It would be nice if there was a pip freeze that wouldn't always necessary print them by alphabetical order but rather top down or bottom up.

I'll probably write in a command option and do a pull-request.

Stay tuned.

@tisdall
Copy link
Author

tisdall commented Jan 31, 2015

I'm more concerned about going the other direction. Cases where a package
isn't a requirement but are made use of if available (like Cython).

However, if what I'm suggesting is in place, then it would be good if
"freeze" returned the packages in the order they were installed. But, I'd
that info even available? Could it be assumed from file timestamps?
On Jan 30, 2015 10:46 PM, "Justin Lee" notifications@github.com wrote:

This has bothered me for some time. It would be nice if there was a pip
freeze that wouldn't always necessary print them by alphabetical order but
rather top down or bottom.

I'll probably write in a command option and do a pull-request.

Stay tuned.


Reply to this email directly or view it on GitHub
#2362 (comment).

@risingmoon
Copy link

That's actually not a bad idea; pip freeze based on file timestamp. Currently it's not in there; pip freeze right now actively sorts alphabeticaly. It's definitely its doable.

So what you're saying is a way to specify certain packages as not required but possibly recommended? Like IPython? I don't need it, but it's definitely nifty at times to install it.

@tisdall
Copy link
Author

tisdall commented Feb 2, 2015

Yes and no. There's no way here to specify a package will use Cython if
available, but of a particular order is maintained then you know it'll be
used. Also, with what you're saying, duplicating an environment will more
likely to be a duplicate. (otherwise, your current environment may have
used Cython, but a freeze and install later may mean the new environment
didn't make use of it)
On Jan 31, 2015 3:58 PM, "Justin Lee" notifications@github.com wrote:

That's actually not a bad idea; pip freeze based on file timestamp.
Currently it's not in there; pip freeze right now actively sorts
alphabeticaly. I definitely its doable.

So what you're saying is a way to specify certain packages as not required
but possibly recommended? Like IPython? I don't need it, but it's
definitely nifty at times to install it.


Reply to this email directly or view it on GitHub
#2362 (comment).

@dstufft
Copy link
Member

dstufft commented Mar 5, 2015

The order of installation can not be depended on, in the future this is likely to get changed so it can build/install in parallel. I don't see us changing this at any point.

@dstufft dstufft closed this as completed Mar 5, 2015
@tisdall
Copy link
Author

tisdall commented Mar 6, 2015

As for me, I think I'd rather have a convenient way of duplicating a build environment then to have some speed increase from parallel installation. If the order the packages are installed affects the state of the environment (which even though it probably shouldn't does occur), wouldn't it make sense to have some way to enforce that order? Perhaps some method of grouping or giving a priority score?

@tisdall
Copy link
Author

tisdall commented Jun 3, 2015

Has the policy changed? It seems like the latest release of pip installs in the order it finds them in the file.

@Demetrio92
Copy link

I just drop by to say it's horrible. I have a requirements.txt which just won't install automatically because package X depends on cython. Both of them are in the requirements.txt, but there is no way to tell pip to install cython first (even though cython is alphabetically above the package X). So the line with cython in the file is simply useful. Everyone trying to set up the dev enviroment will figure out they need it.

@tisdall
Copy link
Author

tisdall commented Sep 4, 2018

I've switched to having a "requirements-buildenv.txt" and then a "requirements.txt". The first has such things as pip and cython versions and the latter is everything else that can be installed in any order.

@Demetrio92
Copy link

@tisdall I forgot to link this issue apparently. I did not just rant, I also created a feature request. Apparently it's been solved in PEP 518 (hooray!).

see #5761 for a discussion

@tisdall
Copy link
Author

tisdall commented Sep 4, 2018

@Demetrio92 - thanks for linking that! I wasn't aware of that PEP. I'm not sure it helps when trying to pin all dependencies to particular versions to make sure your dev environment matches your production environment (which is what I use the requirements.txt for, as well as just collecting dependencies).

@Demetrio92
Copy link

@tisdall seems to be able to specify versions the same way requirements.txt would do

@lock
Copy link

lock bot commented Jun 1, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 1, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests

4 participants