Arabasta
Arabasta

Reputation: 815

Tensorflow and Anaconda on Ubuntu?

On my Ubuntu 14.04, I have installed tensorflow, using "pip", as specified in the Tensorflow Installation instructions and I made sure it was working by importing it in python and it did work.

Then, I installed Anaconda and it changed my .bashrc file by adding the following line to it:

export PATH="/home/sonny/anaconda2/bin:$PATH"

But because of this change, now it looks into the PATH above, which doesn't contain tensorflow. now I can't import tensorflow in my python code.

What is the proper way to extend the $PATH environment variable so that it stays using everything from anaconda2 but it becomes able to import "tensorflow"?

Upvotes: 17

Views: 35411

Answers (7)

Fuevo
Fuevo

Reputation: 152

Actually, the TensorFlow Official website made every detail of installing. The Operation System Windows, Mac OS, Ubuntu; the environment with GPU or just CPU, every single detail of problems you may come up with.

Check this out

Installing TensorFlow on Ubuntu with Anaconda

you will not regret.

Once you visit that you may also find like

Installing TensorFlow on Windows with Anaconda

Upvotes: 0

Sai Harsha
Sai Harsha

Reputation: 39

Install tensorflow from the following command. Conda will take care of the installation process.

conda install -c conda-forge tensorflow

Upvotes: 1

yxtay
yxtay

Reputation: 546

Since v0.10.0, tensorflow is a community maintained conda package in the conda-forge channel. Hence, it can be installed directly with the following command:

conda install -c conda-forge tensorflow

The instructions on the TensorFlow documentation has also been updated.

To facilitate future updates, it is probably a good idea to add conda-forge channel into your conda config:

conda config --add channels conda-forge

In fact, tensorflow=0.10.0rc0 was recently added onto the Anaconda default channel and will be installed instead if the conda-forge channel is not specified:

conda install tensorflow

Upvotes: 16

gkhnavarro
gkhnavarro

Reputation: 466

I solved the problem using this:

conda create --name=tensorenv python=3.4
source activate tensorenv

Upvotes: 0

Arabasta
Arabasta

Reputation: 815

I solved the problem but in a different way! I found a link where the tensorflow.whl files were converted to conda packages, so I went ahead and installed it using the command:

conda install -c https://conda.anaconda.org/jjhelmus tensorflow

and it worked, since the $PATH points to anaconda packages, I can import it now!

Source is here

Upvotes: 36

Freek Wiekmeijer
Freek Wiekmeijer

Reputation: 4940

I suspect that pip is giving you a TensorFlow installation in cpython, not anaconda.

How about a virtualenv?

# Create env
$ virtualenv --python=/path/to/anaconda /path/to/your/env

# Activate env
$ source /path/to/your/env/bin/activate

# Install Tensorflow
$ pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl

Upvotes: 1

gauss256
gauss256

Reputation: 2653

I had the same problem and decided it was easiest to start over, install Anaconda first and then TensorFlow after that.

Upvotes: 2

Related Questions