The way SDK uses its own version is causing problem for its installation

Bug #1672238 reported by Qiming Teng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack SDK
New
Undecided
Unassigned

Bug Description

The openstack/version module is current referenced inside the source code at two locations:

- The openstack.utils module
- The openstack.session module

Since the versions are about to be generated by pbr firstly and pbr invokes the openstack/__init__ module when doing installation ... this is creating a problem for installation.

Stack Trace 1:

$ sudo pip install -e .

  Obtaining file:///opt/stack/sdk
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 10, in <module>
        from setuptools.extern.six.moves import filter, map
      File "/usr/local/lib/python2.7/dist-packages/setuptools/extern/__init__.py", line 1, in <module>
        from pkg_resources.extern import VendorImporter
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3019, in <module>
        @_call_aside
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3003, in _call_aside
        f(*args, **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3047, in _initialize_master_working_set
        for dist in working_set
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3047, in <genexpr>
        for dist in working_set
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2577, in activate
        declare_namespace(pkg)
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2151, in declare_namespace
        _handle_ns(packageName, path_item)
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2086, in _handle_ns
        loader.load_module(packageName)
      File "/usr/lib/python2.7/pkgutil.py", line 246, in load_module
        mod = imp.load_module(fullname, self.file, self.filename, self.etc)
      File "/opt/stack/sdk/openstack/__init__.py", line 13, in <module>
        from openstack import connection # NOQA
      File "/opt/stack/sdk/openstack/connection.py", line 68, in <module>
        from openstack import proxy
      File "/opt/stack/sdk/openstack/proxy.py", line 14, in <module>
        from openstack import resource
      File "/opt/stack/sdk/openstack/resource.py", line 43, in <module>
        from openstack import utils
      File "/opt/stack/sdk/openstack/utils.py", line 18, in <module>
        from openstack import version
      File "/opt/stack/sdk/openstack/version.py", line 16, in <module>
        __version__ = pbr.version.VersionInfo('openstacksdk').version_string()
      File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 465, in version_string
        return self.semantic_version().brief_string()
      File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 460, in semantic_version
        self._semantic = self._get_version_from_pkg_resources()
      File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 440, in _get_version_from_pkg_resources
        provider = pkg_resources.get_provider(requirement)
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 427, in get_provider
        return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
    TypeError: 'NoneType' object is not callable

Stack trace 2:

  $ sudo pip install -e .
  Obtaining file:///opt/stack/sdk
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 10, in <module>
        from setuptools.extern.six.moves import filter, map
      File "/usr/local/lib/python2.7/dist-packages/setuptools/extern/__init__.py", line 1, in <module>
        from pkg_resources.extern import VendorImporter
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3019, in <module>
        @_call_aside
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3003, in _call_aside
        f(*args, **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3047, in _initialize_master_working_set
        for dist in working_set
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3047, in <genexpr>
        for dist in working_set
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2577, in activate
        declare_namespace(pkg)
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2151, in declare_namespace
        _handle_ns(packageName, path_item)
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2086, in _handle_ns
        loader.load_module(packageName)
      File "/usr/lib/python2.7/pkgutil.py", line 246, in load_module
        mod = imp.load_module(fullname, self.file, self.filename, self.etc)
      File "/opt/stack/sdk/openstack/__init__.py", line 13, in <module>
        from openstack import connection # NOQA
      File "/opt/stack/sdk/openstack/connection.py", line 68, in <module>
        from openstack import proxy
      File "/opt/stack/sdk/openstack/proxy.py", line 14, in <module>
        from openstack import resource
      File "/opt/stack/sdk/openstack/resource.py", line 43, in <module>
        from openstack import utils
      File "/opt/stack/sdk/openstack/utils.py", line 18, in <module>
        from openstack import version
      File "/opt/stack/sdk/openstack/version.py", line 16, in <module>
        __version__ = pbr.version.VersionInfo('openstacksdk').version_string()
      File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 465, in version_string
        return self.semantic_version().brief_string()
      File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 460, in semantic_version
        self._semantic = self._get_version_from_pkg_resources()
      File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 440, in _get_version_from_pkg_resources
        provider = pkg_resources.get_provider(requirement)
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 427, in get_provider
        return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
    TypeError: 'NoneType' object is not callable

Revision history for this message
Brian Curtin (brian.curtin) wrote :

We've had a bunch of problems with this but I'm not really sure what to do. PBR has always caused more problems than it's solved so I'd rather we just not use it at all, if that's possible.

Also, I don't remember why we had to do this, but we switched away from having the version inside openstack.__init__ to having openstack.version.__version__. Would moving it back help anything?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to python-openstacksdk (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/446823

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to python-openstacksdk (master)

Reviewed: https://review.openstack.org/446823
Committed: https://git.openstack.org/cgit/openstack/python-openstacksdk/commit/?id=ca292847ef5cc3e6be0ef3e0ea3bfa35905fa65d
Submitter: Jenkins
Branch: master

commit ca292847ef5cc3e6be0ef3e0ea3bfa35905fa65d
Author: tengqm <email address hidden>
Date: Thu Mar 16 23:01:10 2017 -0400

    Avoid imports in openstack/__init__.py

    These imports are creating problems when installing sdk. The problem
    might be caused by new pbr logics. However, I think fixing them from
    SDK side is much easier.

    Change-Id: I2f028e383d790edd1c28dea74056b96e87fe285c
    Related-Bug: #1672238

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.