Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install TensorFlow with specific version on Anaconda

TensorFlow has multiple versions, if I want to install a specific version in Anaconda, which command should I use?

like image 694
user288609 Avatar asked Jul 31 '17 21:07

user288609


People also ask

How do I install an older version of TensorFlow?

To download an older version of TensorFlow make sure you are using an older version of python as well. Otherwise, you will run into an issue like no version satisfying requirement found . Use pip install tensorflow==1.4 or so.


1 Answers

I find the existing answers unsatisfying, as the OP asked specifically about Anaconda but the answers are just pip installs.

You can list the available versions for install doing

conda search tensorflow-gpu

which should give you some output that looks like

Loading channels: done
# Name                       Version           Build  Channel             
tensorflow-gpu                 1.4.1               0  pkgs/main           
tensorflow-gpu                 1.5.0               0  pkgs/main           
tensorflow-gpu                 1.6.0               0  pkgs/main           
tensorflow-gpu                 1.7.0               0  pkgs/main           
tensorflow-gpu                 1.8.0      h7b35bdc_0  pkgs/main           
tensorflow-gpu                 1.9.0      hf154084_0  pkgs/main           
tensorflow-gpu                1.10.0      hf154084_0  pkgs/main           
tensorflow-gpu                1.11.0      h0d30ee6_0  pkgs/main           
tensorflow-gpu                1.12.0      h0d30ee6_0  pkgs/main           
tensorflow-gpu                1.13.1      h0d30ee6_0  pkgs/main           
tensorflow-gpu                1.14.0      h0d30ee6_0  pkgs/main           
tensorflow-gpu                1.15.0      h0d30ee6_0  pkgs/main           
tensorflow-gpu                 2.0.0      h0d30ee6_0  pkgs/main           
tensorflow-gpu                 2.1.0      h0d30ee6_0  pkgs/main           
tensorflow-gpu                 2.2.0      h0d30ee6_0  pkgs/main

If you need to specify a particular channel, the -c/--channel option is your friend, for example:

conda search -c conda-forge tensorflow-gpu

Then you can select your version by passing it to the install command, for example:

conda install tensorflow-gpu==2.0.0

If you needed the channel option in your search, you should add the same option to the conda install command. Note this will work the same for tensorflow (i.e. not the GPU version), just change the package name accordingly.

YAML Configuration

If you use YAML environment configuration files, you can do the same thing:

# environment.yaml
name: my_conda_env
channels:
  - conda-forge
dependencies:
  - tensorflow-gpu=2.0.0

Create your environment with command:

conda env create -f environment.yaml

or if you change the version of an already created environment:

conda env update -f environment.yaml
like image 131
adamconkey Avatar answered Sep 22 '22 23:09

adamconkey