pythontensorflowconda

InvalidVersionSpecError: Invalid version spec: =2.7


I first tried to install tensorflow=2.4.0 in Conda with the channel defaults, but it caused an error:

conda install tensorflow=2.4.0

Error:

Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
  - tensorflow=2.4.0

Current channels:

  - https://repo.continuum.io/pkgs/main/linux-64
  - https://repo.continuum.io/pkgs/main/noarch
  - https://repo.continuum.io/pkgs/free/linux-64
  - https://repo.continuum.io/pkgs/free/noarch
  - https://repo.continuum.io/pkgs/r/linux-64
  - https://repo.continuum.io/pkgs/r/noarch
  - https://repo.continuum.io/pkgs/pro/linux-64
  - https://repo.continuum.io/pkgs/pro/noarch

Then I'm tried using the Conda Forge channel:

conda install -c conda-forge tensorflow=2.4.0

Error:

Solving environment: failed
InvalidVersionSpecError: Invalid version spec: =2.7

How do I resolve this error?


Solution

  • It looks like you are trying to install using an older version of conda. There is a similar issue posted here: https://github.com/facebookresearch/vissl/issues/198

    Try to update conda to 4.9.2 or higher using:

    conda update conda -n base -y
    

    If you don't have permission to update your conda version, you can always create a new environment with conda in it, and use that environment to install the package.

    (base)$ conda create -n conda_env python conda==4.9.2
    (base)$ conda activate conda_env
    (conda_env)$ conda init --user
    (conda_env)$ conda install tensorflow==2.4.0 -n my_other_env
    

    You should check that your conda_env is picking up whichever config options you have as well.