Pip: requirements.txt: option to specify if a specific entry should be installed from source or wheel

Created on 27 Feb 2017  路  6Comments  路  Source: pypa/pip

Hello,
we have a pretty long requirements.txt file (170+ entries) and we recently upgraded pip to 9.0.1 which seems (correct me if i'm wrong) to prefer to install the manylinux wheel, if present, over the source tarball when a simple module==version is specified.

Now, we do need to install a wheel for a specific module but for all the others we prefer to install and build from source (in particular as in some situation we cannot use the wheel at all, cfr https://github.com/numpy/numpy/issues/7570, and there are many of such modules).

is there a way to extend the r.txt entry from module==version to a format that specify if to install that module from wheel or source? or just tell pip to install all modules from source tarball except for a specific list of modules that need to be installed from wheel? for now we are replacing the problematic entries with hardcoded URLs to the source tarballs on PyPI but it's ugly, less expressive and fragile.

thanks!

auto-locked docs

Most helpful comment

Sorry, I meant to add a link to the docs - https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption--no-binary it should all be in there (and under "Requirements file format" if you want to do it in a requirements file), but basically

$ pip install module==version --no-binary=module

All 6 comments

The --no-binary and --only-binary flags are probably what you want. They can be specified on the command line or in a requirements file.

how do i specify them, like module==version;--nobinary ?

Sorry, I meant to add a link to the docs - https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption--no-binary it should all be in there (and under "Requirements file format" if you want to do it in a requirements file), but basically

$ pip install module==version --no-binary=module

oh yes, it works! i added exactly what you suggested, module==version --no-binary=module in r.txt and worked as expected. Could you please document explicitly the usage of options in r.txt? as currently described in the doc, i couldnt figure it out the syntax nor if that was allowed at all. tahnks!

If you feel it could be better worded, then a PR with clarified wording would be much appreciated!

I'm going to go ahead and close this, I'm not sure there is a value in keeping this issue open, however PRs to improve documentation are always welcome.

Was this page helpful?
0 / 5 - 0 ratings