Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python setup.py sdist error Versioning for this project requires either an sdist tarball, or access to an upstream git repository

Tags:

python

tosca-parser downloaded from github, when using python setup.py develop, it complains: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. So I use python setup.py sdist instead, the error is the same:

ERROR:root:Error parsing
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pbr/core.py", line 96, in pbr
    attrs = util.cfg_to_args(path, dist.script_args)
  File "/usr/lib/python2.7/site-packages/pbr/util.py", line 270, in cfg_to_args
    pbr.hooks.setup_hook(config)
  File "/usr/lib/python2.7/site-packages/pbr/hooks/__init__.py", line 25, in setup_hook
    metadata_config.run()
  File "/usr/lib/python2.7/site-packages/pbr/hooks/base.py", line 27, in run
    self.hook()
  File "/usr/lib/python2.7/site-packages/pbr/hooks/metadata.py", line 26, in hook
    self.config['name'], self.config.get('version', None))
  File "/usr/lib/python2.7/site-packages/pbr/packaging.py", line 874, 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 tosca-parser was given, but was not able to be found.
error in setup command: Error parsing /home/tiina/tosca/tosca-parser-master/setup.cfg: 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 tosca-parser was given, but was not able to be found.

I run the same command after git init, then the error is gone. What I don't understand is from where it requires an upstream git repository?

like image 635
Tiina Avatar asked Nov 14 '19 10:11

Tiina


1 Answers

To disable all version calculation logic of pbr set PBR_VERSION

$ export PBR_VERSION=1.2.3 
$ python setup.py sdist

or on one line

$ PBR_VERSION=1.2.3 python setup.py sdist

According to pbr docs

pbr, when run in a git repo, derives the version of a package from the git tags. When run in a tarball with a proper egg-info dir, it will happily pull the version from that. So for the most part, the package maintainers shouldn’t need to care. However, if you are doing something like keeping a git repo with the sources and the packaging intermixed and it’s causing pbr to get confused about whether its in its own git repo or not, you can set PBR_VERSION

like image 126
Levon Avatar answered Sep 21 '22 03:09

Levon