[openstack-dev] [all] UserWarning: Unknown distribution option: 'pbr'

Ian Wienand iwienand at redhat.com
Tue Jan 6 04:00:36 UTC 2015


On 11/27/2014 12:59 PM, Li Tianqing wrote:
> I write a module to extend openstack. When install by python
> setup.py develop, it always blame this

> /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown
> distribution option: 'pbr'
>    warnings.warn(msg)
...
> Processing dependencies for UNKNOWN==0.0.0
> Finished processing dependencies for UNKNOWN==0.0.0

> I do not know why the egg is UNKNOWN, and why the pbr option is
> unknown? i write the name in setup.cfg,

This is because pbr isn't installed.  You probably want to install the
python-pbr package.

I hit this problem today with tox and oslo.config.  tox creates an
sdist of the package on the local system, which because pbr isn't
installed system creates this odd UNKNOWN-0.0.0.zip file.

---
$ /usr/bin/python setup.py sdist --formats=zip
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'pbr'
  warnings.warn(msg)
running sdist
running egg_info
writing UNKNOWN.egg-info/PKG-INFO
writing top-level names to UNKNOWN.egg-info/top_level.txt
...
creating UNKNOWN-0.0.0
----

This isn't a failure, and tox is logging all that to a file, so it's
very not clear that's what has happened.

Then tox tries to install this into the virtualenv *with* pbr, which
explodes in a fairly unhelpful manner:

---
$ tox -e pep8
GLOB sdist-make: /home/iwienand/programs/oslo.config/setup.py
pep8 inst-nodeps: /home/iwienand/programs/oslo.config/.tox/dist/UNKNOWN-0.0.0.zip
ERROR: invocation failed, logfile: /home/iwienand/programs/oslo.config/.tox/pep8/log/pep8-4.log
ERROR: actionid=pep8
msg=installpkg
Unpacking ./.tox/dist/UNKNOWN-0.0.0.zip
  Running setup.py (path:/tmp/pip-z9jGEr-build/setup.py) egg_info for package from file:///home/iwienand/programs/oslo.config/.tox/dist/UNKNOWN-0.0.0.zip
    ERROR:root:Error parsing
    Traceback (most recent call last):
      File "/home/iwienand/programs/oslo.config/.tox/pep8/lib/python2.7/site-packages/pbr/core.py", line 104, in pbr
        attrs = util.cfg_to_args(path)
      File "/home/iwienand/programs/oslo.config/.tox/pep8/lib/python2.7/site-packages/pbr/util.py", line 238, in cfg_to_args
        pbr.hooks.setup_hook(config)
      File "/home/iwienand/programs/oslo.config/.tox/pep8/lib/python2.7/site-packages/pbr/hooks/__init__.py", line 27, in setup_hook
        metadata_config.run()
      File "/home/iwienand/programs/oslo.config/.tox/pep8/lib/python2.7/site-packages/pbr/hooks/base.py", line 29, in run
        self.hook()
      File "/home/iwienand/programs/oslo.config/.tox/pep8/lib/python2.7/site-packages/pbr/hooks/metadata.py", line 28, in hook
        self.config['name'], self.config.get('version', None))
      File "/home/iwienand/programs/oslo.config/.tox/pep8/lib/python2.7/site-packages/pbr/packaging.py", line 554, 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?
---

I proposed [1] to oslo.config to basically avoid the sdist phase.
This seems to be what happens elsewhere.

I started writing a bug for the real issue, but it's not clear to me
where it belongs.  It seems like distutils should error for "unknown
distribution option".  But then setuptools seems be ignoring the
"setup_requires=['pbr']" line in the config.  But maybe tox should be
using pip to install rather than setup.py.

So if any setuptools/distribute/pip/pbr/tox people want to point me to
who should own the problem, happy to chase it up...

-i

[1] https://review.openstack.org/#/c/145119/



More information about the OpenStack-dev mailing list