tensorflow: ImportError: No module named tensorflow - Can't install Tensorflow
I am trying to install tensorflow on mac and it’s giving me this error.
ImportError: No module named tensorflow
Here is what I have done in the terminal
`sudo easy_install pip
sudo easy_install --upgrade six export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/tensorflow-0.9.0-py3-none-any.whl sudo -H pip3 install --upgrade $TF_BINARY_URL`
After that I try to run python and tensorflow to check my installation. It doesn’t work. I have spent 3 hours on the problem.
Here is another post about it. http://stackoverflow.com/questions/40472144/importerror-no-module-named-tensorflow-cant-install-tensorflow?noredirect=1#comment68200554_40472144
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 22 (3 by maintainers)
i had the same issue. and here is why it happen and how i fixed it in my issue: env: anaconda (python 3.6)+mac , first ,i used : $ pip3 install tensorflow $ python Python 3.6.0 |Anaconda 4.3.0 (x86_64)| (default, Dec 23 2016, 13:19:00)
ModuleNotFoundError: No module named ‘tensorflow’
and then $pip install tensorflow $python Python 3.6.0 |Anaconda 4.3.0 (x86_64)| (default, Dec 23 2016, 13:19:00)
I had the same issue with mac os… this fixed the problem: install brew brew install python export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/tensorflow-0.9.0-py2-none-any.whl sudo pip install --upgrade $TF_BINARY_URL
Please consider these things:
I understand it is frustrating to spend 3 hours having trouble, but it is hard for us to help you when you do not provide detailed information. Thanks.
If you use brew:
Anyway, $ python --version Python 3.5.2 :: Continuum Analytics, Inc.
$ echo $TF_BINARY_URL https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.1-py3-none-any.whl
When running: $ sudo pip3 install --ignore-installed --upgrade $TF_BINARY_URL
it looks like it installs everything 100% $ conda list … tensorflow-gpu 0.12.1 <pip> …
but when running $ jupyter notebook import tensorflow as tf ModuleNotFoundError: No module named ‘tensorflow’
For Jupyter kernel to reflect changes in conda env (tensorflow), I had to set up the following:
my blog
卧槽 解决了 很给力!
わあ、解決し、すごい
Hi @aselle ,
THIS IS SOLVED, SEE BOTTOM COMMENT I am having the same error too. I am using EI Capitan 10.11.2
Here is what i did in my installation, no error during the installation:
Here is my tensor flow information:
here is my protobuf information:
here is my six information:
Following is my python version:
UPDATE: It seems that my pip is link to python 2.7.12 (previously installed via Homebrew). I uninstall everything, and reinstall to solve the issue
I have another stituation, I have succssfully installed tensorflow on my mac, and a function which uses tensorflow’s model can run by its own. However, when I import this fuction in Django, the first line is ‘import tensorflow as tf’, error: ModuleNotFoundError: No module named ‘tensorflow’… wtf
I create a virtual environment, when I run some codes ,give the same Error. And I reinstall tensorflow , but it doesn’t work
@Afrogeek254 I also stumbled on this problem, and fixed it by changing python version. (Win10 x64) Funny thing is that the first version I tried is the one “supported” by TF as said in the documentation (used the link in the page for 3.6.x 64 which was 3.6.2). Didn’t want to find a workaround, and ended up installing 3.5.2 (also linked in the installation docs)
i had the same issue. i installed two version of python 2.7 and 3.5 tensorflow installs in python2.7
my default python version is 3.5 so if I type: python Python 3.5.3 (default, Dec 7 2017, 09:41:57) [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux Type “help”, “copyright”, “credits” or “license” for more information.
but if I type: python2.7 Python 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2 Type “help”, “copyright”, “credits” or “license” for more information.
It`s OK
so check your python version. It will help
chunchuria umbrella