Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: requirements.txt specify module with two version ranges

Tags:

python

pip

I'd like to specify the versions of tensorflow in a Python module. The agreeable versions are:

(version >= 1.14.0 and version < 2.0) or (version >= 2.2)

Does anyone know how to express this strange situation in a requirements.txt file? I believe there's a syntax for forbidding specific versions of a module, but I haven't been able to find it...

like image 267
duhaime Avatar asked Jul 26 '26 09:07

duhaime


1 Answers

From PEP 440 Version Specifiers:

tensorflow >=1.14.0,!=2.0.*,!= 2.1.*

The comma , represents a logical and.

Note that requirements.txt files are used for pinning a deployment, I would generally only expect to ever see == specifiers used in those files.

like image 101
wim Avatar answered Jul 28 '26 21:07

wim