NOTE: Only file GitHub issues for bugs and feature requests. All other topics will be closed.
Some of the issues when searching for "import tensorflow as tf" gave answers related to either mock not being installed correctly or protobuf. In my case, all were installed correctly and successfully.
Operating System:
Amazon Linux
Installed version of CUDA and cuDNN:
(please attach the output of ls -l /path/to/cuda/lib/libcud*
):
I installed a CPU only version. So no CUDA
If installed from binary pip package, provide:
python -c "import tensorflow; print(tensorflow.__version__)"
.sudo -H /usr/local/bin/pip install tensorflow
Requirement already satisfied: tensorflow in /usr/local/lib64/python2.7/site-packages
Requirement already satisfied: numpy>=1.11.0 in /usr/local/lib64/python2.7/site-packages (from tensorflow)
Requirement already satisfied: mock>=2.0.0 in /usr/local/lib/python2.7/site-packages (from tensorflow)
Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python2.7/site-packages (from tensorflow)
Requirement already satisfied: protobuf==3.1.0 in /usr/local/lib/python2.7/site-packages (from tensorflow)
Requirement already satisfied: wheel in /usr/local/lib/python2.7/site-packages (from tensorflow)
Requirement already satisfied: funcsigs>=1; python_version < "3.3" in /usr/local/lib/python2.7/site-packages (from mock>=2.0.0->tensorflow)
Requirement already satisfied: pbr>=0.11 in /usr/local/lib/python2.7/site-packages (from mock>=2.0.0->tensorflow)
Installed each of the dependencies individually. Still same issue.
python -c "import tensorflow; print(tensorflow.__version__)"
Traceback (most recent call last):
File "
File "/usr/local/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in
from tensorflow.python import *
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 106, in
from tensorflow.python.platform import test
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/platform/test.py", line 81, in
import mock # pylint: disable=g-import-not-at-top,unused-import
File "/usr/local/lib/python2.7/site-packages/mock/__init__.py", line 2, in
import mock.mock as _mock
File "/usr/local/lib/python2.7/site-packages/mock/mock.py", line 71, in
_v = VersionInfo('mock').semantic_version()
File "/usr/local/lib/python2.7/site-packages/pbr/version.py", line 460, in semantic_version
self._semantic = self._get_version_from_pkg_resources()
File "/usr/local/lib/python2.7/site-packages/pbr/version.py", line 447, in _get_version_from_pkg_resources
result_string = packaging.get_version(self.package)
File "/usr/local/lib/python2.7/site-packages/pbr/packaging.py", line 725, in get_version
raise Exception("Versioning for this project requires either an sdist"
Ok, this was resolved. The only thing I had to do was to upgrade the distribute module - "pip install --upgrade distribute".
Most helpful comment
Ok, this was resolved. The only thing I had to do was to upgrade the distribute module - "pip install --upgrade distribute".