New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No module named tensorflow #7126

Closed
kindlychung opened this Issue Jan 28, 2017 · 7 comments

Comments

Projects
None yet
5 participants
@kindlychung

kindlychung commented Jan 28, 2017

System: macos sierra
Python 3.5.2 via anaconda, a special env tensorflow created and used (source activate tensorflow)

Here is how I installed the package:

  export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.1-py3-none-any.whl
  pip install --ignore-installed --upgrade $TF_BINARY_URL

pip says all packages have been successfully installed, but if I try to import tensorflow, python says there is no such module.

It seems the module is named tensorflow_gpu:

(tensorflow) kaiyin@kaiyins-mbp 13:19:02 | ~ =>
pip show tensorflow
(tensorflow) kaiyin@kaiyins-mbp 13:19:09 | ~ =>
pip show tensorflow_gpu
Name: tensorflow-gpu
Version: 0.12.1
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: /Users/kaiyin/anaconda3/envs/tensorflow/lib/python3.5/site-packages
Requires: wheel, numpy, protobuf, six

Although tensorflow_gpu couldn't be imported, either.

Any idea what's going on here?

@drpngx

This comment has been minimized.

Show comment
Hide comment
@drpngx

drpngx Jan 28, 2017

Member

@gunan any idea?

Member

drpngx commented Jan 28, 2017

@gunan any idea?

@yaroslavvb

This comment has been minimized.

Show comment
Hide comment
@yaroslavvb

yaroslavvb Jan 28, 2017

Contributor

@kindlychung this could be a message produced by Python package loader because it can't find the packages, or it can be caused by pywraptensorflow.so crashing with an exception. One way to tell which one it is, is to run under strace (sudo dtruss on Mac), and see what files it's opening, and that it eventually opens TensorFlow files from the correct site-packages directory

Contributor

yaroslavvb commented Jan 28, 2017

@kindlychung this could be a message produced by Python package loader because it can't find the packages, or it can be caused by pywraptensorflow.so crashing with an exception. One way to tell which one it is, is to run under strace (sudo dtruss on Mac), and see what files it's opening, and that it eventually opens TensorFlow files from the correct site-packages directory

@kindlychung

This comment has been minimized.

Show comment
Hide comment
@kindlychung

kindlychung Jan 28, 2017

I did a few things:

pip install ipython
cd /usr/local/cuda/lib
ln -s libcuda.dylib libcuda.1.dylib

And now I can load tensorflow without a problem. Not sure which of the above solved it.

kindlychung commented Jan 28, 2017

I did a few things:

pip install ipython
cd /usr/local/cuda/lib
ln -s libcuda.dylib libcuda.1.dylib

And now I can load tensorflow without a problem. Not sure which of the above solved it.

@yaroslavvb

This comment has been minimized.

Show comment
Hide comment
@yaroslavvb

yaroslavvb Jan 28, 2017

Contributor

It's the pip install ipython line. If you don't install ipython, then using ipython from your env will use ipython from outside your env, and hence switch the load paths to be outside of your env (hence no tensorflow)

This issue has been diagnosed by an earlier user who updated documentation to help future users avoid this problem in
#3514

Contributor

yaroslavvb commented Jan 28, 2017

It's the pip install ipython line. If you don't install ipython, then using ipython from your env will use ipython from outside your env, and hence switch the load paths to be outside of your env (hence no tensorflow)

This issue has been diagnosed by an earlier user who updated documentation to help future users avoid this problem in
#3514

@yaroslavvb yaroslavvb closed this Jan 28, 2017

@arifle

This comment has been minimized.

Show comment
Hide comment
@arifle

arifle Mar 23, 2017

The same problem in Windows 7.
Everything works well before the test command, "import tensorflow as tf".
D:\Python35\Scripts>pip show tensorflow

Metadata-Version: 2.0
Name: tensorflow
Version: 1.0.1
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
Installer: pip
License: Apache 2.0
Location: d:\python35\lib\site-packages
Requires: numpy, six, protobuf, wheel
Classifiers:
Development Status :: 4 - Beta
Intended Audience :: Developers
Intended Audience :: Education
Intended Audience :: Science/Research
License :: OSI Approved :: Apache Software License
Programming Language :: Python :: 2.7
Topic :: Scientific/Engineering :: Mathematics
Topic :: Software Development :: Libraries :: Python Modules
Topic :: Software Development :: Libraries
Entry-points:
[console_scripts]
tensorboard = tensorflow.tensorboard.tensorboard:main
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.

arifle commented Mar 23, 2017

The same problem in Windows 7.
Everything works well before the test command, "import tensorflow as tf".
D:\Python35\Scripts>pip show tensorflow

Metadata-Version: 2.0
Name: tensorflow
Version: 1.0.1
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
Installer: pip
License: Apache 2.0
Location: d:\python35\lib\site-packages
Requires: numpy, six, protobuf, wheel
Classifiers:
Development Status :: 4 - Beta
Intended Audience :: Developers
Intended Audience :: Education
Intended Audience :: Science/Research
License :: OSI Approved :: Apache Software License
Programming Language :: Python :: 2.7
Topic :: Scientific/Engineering :: Mathematics
Topic :: Software Development :: Libraries :: Python Modules
Topic :: Software Development :: Libraries
Entry-points:
[console_scripts]
tensorboard = tensorflow.tensorboard.tensorboard:main
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.

@arifle

This comment has been minimized.

Show comment
Hide comment
@arifle

arifle Mar 23, 2017

and this
D:\Python35\Scripts>pip list
appdirs (1.4.3)
numpy (1.12.1)
packaging (16.8)
pip (8.1.1)
protobuf (3.2.0)
pyparsing (2.2.0)
setuptools (34.3.2)
six (1.10.0)
tensorflow (1.0.1)
wheel (0.29.0)
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.

arifle commented Mar 23, 2017

and this
D:\Python35\Scripts>pip list
appdirs (1.4.3)
numpy (1.12.1)
packaging (16.8)
pip (8.1.1)
protobuf (3.2.0)
pyparsing (2.2.0)
setuptools (34.3.2)
six (1.10.0)
tensorflow (1.0.1)
wheel (0.29.0)
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.

@gunan

This comment has been minimized.

Show comment
Hide comment
@gunan

gunan Mar 23, 2017

Member

This is an already resolved issue.
Please try the suggestions above. If they do not work, please file a new issue filling in the full issue template.

Member

gunan commented Mar 23, 2017

This is an already resolved issue.
Please try the suggestions above. If they do not work, please file a new issue filling in the full issue template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment