Skip to content Skip to sidebar Skip to footer

Tensorflow - Cannot Install Tensorflow From Anaconda

I am trying to access tensorflow from two ways, both of which are failing: Installed Anaconda (Windows 32 bit Python 3.6). Then, created a conda environment with Python 3.6 (also

Solution 1:

Open an anaconda prompt, and create an environment with tensorflow like this:

conda create -n tf tensorflow
activate tf
# Verify that it works
python -c "import tensorflow"

Then, you probably have to specify that environment from within Spyder. Open Preferences->Console->Advanced Settings and set the python path to <anaconda_install>/envs/tf/bin/python.

Solution 2:

Open Terminal, then enter:

conda update conda

After installing done, enter:

conda install tensorflow

It will take some time based on your internet speed.

After installing, open Anaconda -> Spyder/Jupyter

import tensorflow as ts

Solution 3:

tensorflow can be installed simply by running following commands

On mac/Windows use following command:

conda install -c conda-forge tensorflow 

This will install the latest Tensorflow on your system. if you wish to upgrade it to newer verion then you can use the following command

conda update -f -c conda-forge tensorflow

However if you have the virtual environment created from anaconda then before doing these steps you have to activate the environment first and then run the command. With this trensorflow will get installed on your specific command

Please refer the example below for more details:

Creating a environment for Tensorflow

  conda create -n “myEnv” python=3.6 anaconda

This will create virtual environment along with anaconda packages. Once this is done, Activate the Environment by :

source activate myEnv #(for mac)
  conda activate myEnv #(for windows)

you will see the following.

Activated the environment

Once the Environment is active. you can now install the packages you need as follows: I am showing you the packages which i work upon on virtual environment and this will take care of most of your dependencies

conda update conda
conda upgrade conda
conda upgrade anaconda

conda install pip
conda install -c conda-forge opencv
conda install -c conda-forge tensorflow 
conda install -c conda-forge keras

Hope this will solve your problem.

Solution 4:

Let's break it down in a couple of steps:

  1. If you don't have, download and install Anaconda.

  2. Access Anaconda Command Prompt for the environment that you want to install TensorFlow. If you don't have an environment created, access the Anaconda Prompt.

  3. Assuming that you don't have an environment created, choose the name of your TensorFlow environment, such as "tensor" and install TensorFlow as following

    conda create -n tensor tensorflow conda activate tensor

If you want to install the GPU TensorFlow (Linux or Windows), in the environment "tensor-gpu", use the following

conda create -n tensor-gpu tensorflow-gpu
conda activate tensor-gpu

TensorFlow is now installed. For more information access their documentation.

Solution 5:

Try to install Spyder within the Anaconda environment in which you want to use tensorflow. This resolved the issue for me.

Post a Comment for "Tensorflow - Cannot Install Tensorflow From Anaconda"