Install Tensorflow 2.0 in conda enviroment

polmonroig picture polmonroig · Mar 28, 2019 · Viewed 63.9k times · Source

I would like to know if anyone knows how can I install tensorflow==2.0.0-alpha0 in a conda enviroment using python 3.7. Is it possible to use python 3.7 or do I have to downgrade to 3.6. Either way what is the command I need to use because the following don't find any package

conda install tensorflow==2.0.0-alpha0
conda install tensorflow 
conda install tensorflow=2.0.0-alpha0

I am using fedora 29 and conda 4.6.8 Thanks!

Answer

Agustin Barrachina picture Agustin Barrachina · Oct 3, 2019

TENSORFLOW 2.0 release version is out!

Since 01/10/2019 I'm not talking beta but the release version.

Using Anaconda (Recommended)

Since 01/11/2019 Anaconda is supporting the Tensorflow 2.0.0.

Option 1: For what the easiest way is just:

conda install tensorflow or conda install tensorflow-gpu

For the gpu mode, anaconda will take care of all the CUDA everything you need to install for the tensorflow gpu mode to work so I strongly recommend using this method.

Option 2 (virtual env): It is strongly recommended to use an environment on where to install tensorflow, for which you need the following command that will create an environment first and then install tensorflow within:

  • CPU: conda create -n <your_env_name> tensorflow
  • GPU: conda create -n <your_env_name> tensorflow-gpu

Change <your_env_name> by a meaningful name like tf-2

To use tensorflow run first conda activate <your_env_name>

Using pip

Using pip the tensorflow official instructions are quite complete.

Just install tensorflow using pip like:

# Current stable release for CPU-only
pip install tensorflow

I yet recommend before doing everything to install tensorflow in a new environment so the 3 steps would be (with anaconda):

conda create --n <our_env_name> pip
conda activate <your_env_name>
pip install tensorflow

Now for the GPU version it's harder with pip, I recommend you this link