Is it possible to have OS specific requirements in pip's requirements.txt file?
For example:
I have a dependency on readline, therefore, if installing on windows (or OSX), then pyreadline is a requirement. If it's linux, then I don't want to force an install.
You can do this with "Environment Markers" as specified in PEP-508:
Here's an example of using such a marker inside a requirements.txt
:
pyreadline==2.1; platform_system == "Windows"
Similarly, in a setup.py
:
setup(
...
install_requires=['pyreadline; platform_system == "Windows"'],
)
In the end, adding the OS check in the setup.py is what I've found other people using. Ex:
install_requires = [
"parsedatetime >= 1.1.2",
"colorama >= 0.2.5",
"pycrypto >= 2.6"
] + ["pyreadline >= 2.0"] if "win" in sys.platform else [],
link to full setup.py with example code