AttributeError 'module' object has no attribute 'version'

4.6k views Asked by At

I am facing openstacksdk version problem.

2016-12-26 07:11:30.069 | +./stack.sh:main:1033 create_keystone_accounts

2016-12-26 07:11:30.074 | +lib/keystone:create_keystone_accounts:372 local admin_tenant

2016-12-26 07:11:30.081 | ++lib/keystone:create_keystone_accounts:373 openstack project show admin -f value -c id

2016-12-26 07:11:31.019 | Traceback (most recent call last):

2016-12-26 07:11:31.019 | File "/usr/local/bin/openstack", line 7, in 

2016-12-26 07:11:31.019 | from openstackclient.shell import main

2016-12-26 07:11:31.019 | File "/usr/local/lib/python2.7/dist-packages/openstackclient/shell.py", line 32, in 

2016-12-26 07:11:31.019 | from openstackclient.common import clientmanager

2016-12-26 07:11:31.019 | File "/usr/local/lib/python2.7/dist-packages/openstackclient/common/clientmanager.py", line 293, in 

2016-12-26 07:11:31.019 | 'openstack.cli.base',

2016-12-26 07:11:31.019 | File "/usr/local/lib/python2.7/dist-packages/openstackclient/common/clientmanager.py", line 264, in get_plugin_modules

2016-12-26 07:11:31.019 | import(ep.module_name)

2016-12-26 07:11:31.019 | File "/usr/local/lib/python2.7/dist-packages/openstackclient/network/client.py", line 16, in 

2016-12-26 07:11:31.019 | from openstack import connection

2016-12-26 07:11:31.019 | File "/usr/local/lib/python2.7/dist-packages/openstack/connection.py", line 68, in 

2016-12-26 07:11:31.019 | from openstack import session as _session

2016-12-26 07:11:31.019 | File "/usr/local/lib/python2.7/dist-packages/openstack/session.py", line 29, in 

2016-12-26 07:11:31.019 | DEFAULT_USER_AGENT = "openstacksdk/%s" % openstack.version

2016-12-26 07:11:31.019 | AttributeError: 'module' object has no attribute 'version'

2016-12-26 07:11:31.041 | +lib/keystone:create_keystone_accounts:373 admin_tenant=

2016-12-26 07:11:31.049 | +lib/keystone:create_keystone_accounts:1 exit_trap

2016-12-26 07:11:31.056 | +./stack.sh:exit_trap:474 local r=1

2016-12-26 07:11:31.064 | ++./stack.sh:exit_trap:475 jobs -p

2016-12-26 07:11:31.072 | +./stack.sh:exit_trap:475 jobs=

2016-12-26 07:11:31.079 | +./stack.sh:exit_trap:478 [[ -n '' ]]

2016-12-26 07:11:31.086 | +./stack.sh:exit_trap:484 kill_spinner

2016-12-26 07:11:31.092 | +./stack.sh:kill_spinner:370 '[' '!' -z '' ']'

2016-12-26 07:11:31.098 | +./stack.sh:exit_trap:486 [[ 1 -ne 0 ]]

2016-12-26 07:11:31.105 | +./stack.sh:exit_trap:487 echo 'Error on exit'

2016-12-26 07:11:31.105 | Error on exit

2016-12-26 07:11:31.110 | +./stack.sh:exit_trap:488 generate-subunit 1482733821 2470 fail

2016-12-26 07:11:31.479 | +./stack.sh:exit_trap:489 [[ -z /opt/stack/logs ]]

2016-12-26 07:11:31.487 | +./stack.sh:exit_trap:492 /opt/stack/devstack/tools/worlddump.py -d /opt/stack/logs

2016-12-26 07:11:31.895 | +./stack.sh:exit_trap:498 exit 1

stack@openstack:~/devstack$

I've tried to find the cause for this from past few days and I found that they updated OpenStack SDK version (UPDATE DEFAULT_USER_AGENT = "openstacksdk/%s" % openstack_version.__version__), But it's not working and throwing the same error. Any help would be very much appreciable.

Thank you in advance.

3

There are 3 answers

0
user3912895 On

Not 100% sure of what's causing this but I was able to get rid of this error by adding an explicit upgrade the python-openstackclient in the stack.sh script right after this section:

# Install the OpenStack client, needed for most setup commands
if use_library_from_git "python-openstackclient"; then
    git_clone_by_name "python-openstackclient"
    setup_dev_lib "python-openstackclient"
else
    pip_install_gr python-openstackclient
fi

I added:

sudo pip install "python-openstackclient==<version_I_want>"
0
Dheeraj Chitara On

Edit the file trove-deshboard/requirements.txt

-e git://... => -e git+https://...

then edit requirements/upper-constraints.txt

openstacksdk===0.8.1 => openstacksdk===0.9.11 or 0.9.12

0
r_cc_c On

The official fix is listed here

https://review.openstack.org/#/c/325088/

I patched directly to /usr/local/lib/python2.7/dist-packages/openstack/

I was able to complete the ./stack.sh script without error