openstack API python - no module named version

1.9k views Asked by At

I'm trying to instanciate VM on openstack using the NovaClient API in python. More precisely with mq-rabbit celery tasks.

Unfortunatly I got this error :

from novaclient import client
File "/usr/local/lib/python2.7/dist-packages/novaclient/__init__.py", line 15, in <module>
import pbr.version
ImportError: No module named version

I already tested with a simple python file and it works, my VM was created but when I try to do this throught a celery tash I got the error above...

My version is the latest python-novaclient-6.0.2, but as our servers are in version 2 I use the version 2 API. Here is my code in my celery task, who works when I test in python shell :

loader = loading.get_plugin_loader('password')
    auth = loader.load_from_options(auth_url=auth_url, username=username, password=password, project_name=tenant_name)
    sess = session.Session(auth=auth)
    nova = client.Client('2', session=sess) #API version and session
1

There are 1 answers

1
Adelin On

Seems it's the same error and this one

Basically what you need is to make sure you have pbr installed.

If you had it already, reinstalling might help

  1. pip uninstall pbr
  2. pip install pbr