Tensorflow: Testing in python - import tensorflow as tf throws error "Exception: Versioning for this project requires either an sdist tarball"

Created on 20 Dec 2016  ·  1Comment  ·  Source: tensorflow/tensorflow

NOTE: Only file GitHub issues for bugs and feature requests. All other topics will be closed.

What related GitHub issues or StackOverflow threads have you found by searching the web for your problem?

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.

Environment info

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:

  1. A link to the pip package you installed:
  2. The output from python -c "import tensorflow; print(tensorflow.__version__)".

If possible, provide a minimal reproducible example (We usually don't have time to read hundreds of lines of your code)

the installation completed successfully. Here is the output:

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)

Requirement already satisfied: setuptools in /usr/local/lib/python2.7/site-packages/setuptools-28.3.0-py2.7.egg (from protobuf==3.1.0->tensorflow)

What other attempted solutions have you tried?

Installed each of the dependencies individually. Still same issue.

### Logs or other output that would be helpful

python -c "import tensorflow; print(tensorflow.__version__)"
Traceback (most recent call last):
File "", line 1, in
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"

Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. Are you sure that git is installed?

Most helpful comment

Ok, this was resolved. The only thing I had to do was to upgrade the distribute module - "pip install --upgrade distribute".

>All comments

Ok, this was resolved. The only thing I had to do was to upgrade the distribute module - "pip install --upgrade distribute".

Was this page helpful?
0 / 5 - 0 ratings