1

My machine already have Tensorflow 8.0 installed using pip. I installed Tensorflow 9.0 from source to support cudnn 5. The thing is when I "import tensorflow" in python it still uses the pip installation.

Can I tell python to import my new installation and ignore the pip installation?

I want to keep the pip installation, because it is being used by other people (the machine is a server).

Thanks, Dan

Dan
  • 482
  • 6
  • 9

1 Answers1

2

You can try one of these (solution 2 is the one I prefer)

1) Install only for your user:

sudo pip install --user /tmp/tensorflow_pkg/tensorflow-0.9.0-py2-none-any.whl

2) Create a virtual environment to isolate it from your system install:

Tensorflow anaconda-installation

3) Add the Tensorflow 9.0 to the sys.path list as in:

import sys
sys.path.insert(0, 'path/to/thensorflow_9')
import tensorflow
...
mc07
  • 61
  • 4
  • Regarding solution 2: How can I ./configure and compile tensorflow myself within the virtualenv instead of using "pip install"? I need to compile because I want to use cudnn 5 and not 4. – Dan Jul 15 '16 at 07:57
  • @Dan, you should create your virtual environment and activate it. After that you proceed with the install from source as usual, and all python references will be taken from your virtual environment. – mc07 Jul 15 '16 at 10:58
  • I tried that (the compiled version is now in its own directory), but python still imports tensorflow 8.0 (from the pip install) instead of 9.0. How can I tell the virtual environment to ignore the old pip install and refer to the new compiled version (in the new directory)? – Dan Jul 15 '16 at 14:30