简体   繁体   中英

openstack API python - no module named version

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM