duhaime
duhaime

Reputation: 27594

Python: requirements.txt specify module with two version ranges

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...

Upvotes: 7

Views: 2787

Answers (1)

wim
wim

Reputation: 362716

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.

Upvotes: 10

Related Questions