1

I just tried installing the tensorflow package for the first time. It worked fine on my OSX Macintosh, but when I tried to install on a Windows computer, I started up Python and got

[py35] [py35nogpu] C:\Users\Brian>ipython
Python 3.5.3 |Continuum Analytics, Inc.| (default, Feb 22 2017, 21:28:42) [MSC v.1900 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 6.0.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import tensorflow
   ...

ImportError: No module named 'tensorflow'

This sure looks like a path error--how can I check that it's using the correct path variable(s)? Because I've tried and failed multiple times using different install instructions, it's likely that my system has conflicting settings now. Specifically, I had Python 3.6 installed before I started this and had to install Python 3.5 (which is required by tensorflow) over it and furthermore, I've attempted to install on both the C: and G: drives.

. Now my tensorflow library is installed in C:\Users\Brian\Anaconda2\envs\py35\Lib\site-packages

and the Windows environment variable PATH contains

C:\Users\Brian\AppData\Local\Programs\Python\Python36\Scripts\

while Python's system path is

print (sys.path)
['', 'G:\\Users\\Brian\\Anaconda2\\envs\\py35\\Scripts', 'G:\\Users\\Brian\\Anaconda2\\envs\\py35\\python35.zip', 'G:\\Users\\Brian\\Anaconda2\\envs\\py35\\DLLs', 'G:\\Users\\Brian\\Anaconda2\\envs\\py35\\lib', 'G:\\Users\\Brian\\Anaconda2\\envs\\py35', 'G:\\Users\\Brian\\Anaconda2\\envs\\py35\\lib\\site-packages', 'G:\\Users\\Brian\\Anaconda2\\envs\\py35\\lib\\site-packages\\setuptools-27.2.0-py3.5.egg', 'G:\\Users\\Brian\\Anaconda2\\envs\\py35\\lib\\site-packages\\IPython\\extensions', 'C:\\Users\\Brian\\.ipython']

(mix of C: and G: drive locations). How to clean this up, or is the problem something else?

Note for anyone who thinks this problem is too specific to my computer to be answered: the TensorFlow folks have specifically asked, in their installation instructions, for people having TensorFlow installation problems to document them by asking questions like this on StackOverflow. Let's hope the answer helps both me and the next person who has the problem.

user2084572
  • 331
  • 3
  • 12

2 Answers2

0

Make sure TensorFlow and Python are installed in the environment you're using. Although the install instructions on the TensorFlow page say to create a tensorflow environment using the following command:

conda create -n tensorflow 

that didn't work for me. Instead I used the following to make sure the environment had both TensorFlow and Python 3.5:

conda create -n tensorflow python=3.5

Activate the environment with activate tensorflow and then open iPython.

Adrienne
  • 326
  • 1
  • 3
  • That was already tried (both versions), to no avail. The problem is something else. For non-tensorflow users reading this, the installation instructions recommend either using pip3, or using conda and ipython as here. I don't know if mixing the two works, so make sure you want to use conda before taking the above advice. – user2084572 May 09 '17 at 21:58
0

The solution to my problem was found in Cannot import Tensorflow for GPU on Windows 10. See also enter link description here to verify the installation.

There are three Windows system variables that need to be defined, and those are referenced in entries in the PATH variable. (At least, I think they're supposed to be, but my Path variable spells the same paths out explicitly for some reason.) The system variables are

CUDA_HOME

CUDA_PATH

CUDNN_PATH

(On my system, the first and third items have the same value--can someone tell me if this is usual?)

It's also necessary to rename a certain file as described in the link, as of Tensorflow version 8.0.

Why didn't I read this answer before posting my question, you ask? Because I searched and didn't find it; but it was listed automatically under the "Related" header when I viewed my own question after posting it.

user2084572
  • 331
  • 3
  • 12