(Update) The Real Problem and Solution

While creating the fork of the python-neutronclient we ran into this problem again. We found that it was simply that the version.py that was being used was looking for the wrong client. It was a problem with the distribution and not the installation.

I made a post about it.

If you run into this problem this may not be a solution anymore!

Old Solution

I was having a problem with an application I just uploaded to pypi. After I pip installed it to my system I got this error when I ran it:

  $ neutron --version
  Traceback (most recent call last):
  File "/usr/local/bin/neutron", line 6, in <module>
  from neutronclient.shell import main
  File "/usr/local/lib/python2.7/dist-packages/neutronclient/shell.py", line 73, in <module>
  from neutronclient.version import __version__
  File "/usr/local/lib/python2.7/dist-packages/neutronclient/version.py", line 22, in <module>
  __version__ = pbr.version.VersionInfo('python-neutronclient').version_string()
  File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 78, in version_string
  for part in self.release_string().split('.'):
  File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 70, in release_string
  self.release = self._get_version_from_pkg_resources()
  File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 62, in _get_version_from_pkg_resources
  return packaging.get_version(self.package)
  File "/usr/local/lib/python2.7/dist-packages/pbr/packaging.py", line 870, 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?

It was a weird error and I quickly learned that it was because pbr expects the git tag to have a v in it. Such as v2.3.7. I provided 2.3.7 and that is what caused the bug.

I simply made a new tag (git tag -a v.2.3.7 -m "yey version") and uploaded to pypi (python setup.py sdist upload -r pypi).
Problem with pbr and “sdist tarball”