Tensorflow textsum error of Versioning

301 Views Asked by At

I am trying to convert the training text file to bin file for training the textsum of tensorflow. But I encountered the following error:

$ python textsum/data_convert_example.py --command text_to_binary --in_file data/tt.txt --out_file data/bin_data_train
Traceback (most recent call last):
  File "textsum/data_convert_example.py", line 12, in <module>
    import tensorflow as tf
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 104, in <module>
    from tensorflow.python.platform import test
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/test.py", line 57, in <module>
    import mock                # pylint: disable=g-import-not-at-top,unused-import
  File "/usr/local/lib/python2.7/dist-packages/mock/__init__.py", line 2, in <module>
    import mock.mock as _mock
  File "/usr/local/lib/python2.7/dist-packages/mock/mock.py", line 71, in <module>
    _v = VersionInfo('mock').semantic_version()
  File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 461, in semantic_version
    self._semantic = self._get_version_from_pkg_resources()
  File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 448, in _get_version_from_pkg_resources
    result_string = packaging.get_version(self.package)
  File "/usr/local/lib/python2.7/dist-packages/pbr/packaging.py", line 755, in get_version
    name=package_name))
Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo. Project name mock was given, but was not able to be found.

Kindly help me. I am using tensorflow 1.2.0 with python 2.7.2.

2

There are 2 best solutions below

1
pltrdy On BEST ANSWER

You must have a problem with your install.

Please try the following commands:

pip install --upgrade mock pip install --upgrade distribute

If it does not work, you should give us more details about how you installed tensorflow (pip? conda? clone & setup.py?) and try to reinstall from scratch.

Hope it helps

0
Mirdalan On

I had the same issue (however not related to tensorflow) and in my case updating setuptools was the fix. I've found the suggestion here: https://github.com/testing-cabal/mock/issues/314

Before update I had setuptools 0.6c11 and I've updated to latest 39.2.0.

pip install --upgrade setuptools

or actually in my case I had to download and install locally since production server has no connection to internet:

pip download setuptools

pip install setuptools-39.2.0-py2.py3-none-any.whl