5

I want to set a dependency in my requirements.txt for tensorflow~=2.5.0. At the time of writing, tensorflow==2.5.0 hasn't been released yet. The latest version available is the release candidate tensorflow==2.5.0rc3. How can I succinctly tell pip to "install the most recent tensorflow 2.5.x version, including release candidates"?

What I've tried so far:

  • tensorflow~=2.5.0
ERROR: Could not find a version that satisfies the requirement tensorflow~=2.5.0 (from versions: 2.5.0rc0, 2.5.0rc1, 2.5.0rc2, 2.5.0rc3)
ERROR: No matching distribution found for tensorflow~=2.5.0
  • tensorflow>2.4.1
ERROR: Could not find a version that satisfies the requirement tensorflow>2.4.1 (from versions: 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 1.15.0rc0, 1.15.0rc1, 1.15.0rc2, 1.15.0rc3, 1.15.0, 1.15.2, 1.15.3, 1.15.4, 1.15.5, 2.0.0a0, 2.0.0b0, 2.0.0b1, 2.0.0rc0, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.1.0rc0, 2.1.0rc1, 2.1.0rc2, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.2.0rc0, 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.2.0, 2.2.1, 2.2.2, 2.3.0rc0, 2.3.0rc1, 2.3.0rc2, 2.3.0, 2.3.1, 2.3.2, 2.4.0rc0, 2.4.0rc1, 2.4.0rc2, 2.4.0rc3, 2.4.0rc4, 2.4.0, 2.4.1, 2.5.0rc0, 2.5.0rc1, 2.5.0rc2, 2.5.0rc3)
ERROR: No matching distribution found for tensorflow>2.4.1
swimmer
  • 1,971
  • 2
  • 17
  • 28

1 Answers1

6

According to section "Pre-release Versions" in the pip documentation:

If a Requirement specifier includes a pre-release or development version (e.g. >=0.0.dev0) then pip will allow pre-release and development versions for that requirement. This does not include the != flag.

This can be tested on the command line. As Tensorflow 2.5.0 is currently not yet released, we get:

$ pip download tensorflow~=2.5.0
ERROR: Could not find a version that satisfies the requirement tensorflow~=2.5.0 (from versions: 2.5.0rc0, 2.5.0rc1, 2.5.0rc2, 2.5.0rc3)
ERROR: No matching distribution found for tensorflow~=2.5.0

But if we add a pre-release version specifier:

$ pip download tensorflow~=2.5.0rc0
Collecting tensorflow~=2.5.0rc0
  Downloading tensorflow-2.5.0rc3-cp39-cp39-win_amd64.whl (422.6 MB)
  …

This would install the regular release once it becomes available.

john-hen
  • 4,410
  • 2
  • 23
  • 40
  • 1
    Thank you! Can confirm that adding `tensorflow~=2.5.0rc0` to `requirements.txt` has the intended effect – swimmer May 12 '21 at 15:41