Inner Exception: cannot import name Random from (pid=25725) import_class /root/openstack/nova/nova/utils.py:65

Asked by Ronnie Chang

Hi, I have been trying to install Nova using XCP as the hypervisor. I've followed the instructions in the wiki page http://wiki.openstack.org/XenServerDevelopment.

Things went ok until I tried to run "run_tests.sh" in nova, then I get a weird problem. As pasted below.

root@rchang-desktop1:~/openstack/nova# ./run_tests.sh -x -N
ERROR

======================================================================
ERROR: <nose.suite.ContextSuite context=nova.tests>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/nose/suite.py", line 208, in run
    self.setUp()
  File "/usr/local/lib/python2.6/dist-packages/nose/suite.py", line 291, in setUp
    self.setupContext(ancestor)
  File "/usr/local/lib/python2.6/dist-packages/nose/suite.py", line 314, in setupContext
    try_run(context, names)
  File "/usr/local/lib/python2.6/dist-packages/nose/util.py", line 478, in try_run
    return func()
  File "/root/openstack/nova/nova/tests/__init__.py", line 47, in setup
    from nova.network import manager as network_manager
  File "/root/openstack/nova/nova/network/manager.py", line 65, in <module>
    from nova.compute import api as compute_api
  File "/root/openstack/nova/nova/compute/__init__.py", line 19, in <module>
    from nova.compute.api import API
  File "/root/openstack/nova/nova/compute/api.py", line 29, in <module>
    import nova.image
  File "/root/openstack/nova/nova/image/__init__.py", line 22, in <module>
    from nova.image import glance
  File "/root/openstack/nova/nova/image/glance.py", line 34, in <module>
    from nova.image import service
ImportError: cannot import name service
-------------------- >> begin captured logging << --------------------
2011-11-24 14:09:37,313 DEBUG nova.utils [-] Inner Exception: cannot import name Random from (pid=25725) import_class /root/openstack/nova/nova/utils.py:65
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 0 tests in 0.017s

FAILED (errors=1)
-------------

Another similar error occurs when I issue the command ./bin/nova-manage, I get the following:

root@rchang-desktop1:~/openstack/nova# ./bin/nova-manage
Traceback (most recent call last):
  File "./bin/nova-manage", line 84, in <module>
    from nova import image
  File "/root/openstack/nova/nova/image/__init__.py", line 22, in <module>
    from nova.image import glance
  File "/root/openstack/nova/nova/image/glance.py", line 43, in <module>
    GlanceClient = utils.import_class('glance.client.Client')
  File "/root/openstack/nova/nova/utils.py", line 66, in import_class
    raise exception.ClassNotFound(class_name=class_str)
nova.exception.ClassNotFound: Class Client could not be found

--------------------------
It looks like when glance falls the "import_class" function, an error pops up.
I am running Nova 2011.3, and python 2.6.5

I tried searching for the random module in my system since it was not importing properly.

root@rchang-desktop1:~/openstack/nova# find / -name random.py
/usr/lib/python2.6/random.py
/usr/local/lib/python2.6/dist-packages/Crypto/Random/random.py

The correct file to import is /usr/lib/python2.6/random.py , the second file was installed by pycrypto as indicated in the pip-requires file.
Thinking that having two random.py file might be the issue, I've deleted the one in Crypto, but to no avail. I've also set $PYTHONPATH to /usr/lib/python2.6 and that is not working either.

Please assist. Any help would be appreciated!

Thanks,
Ronnie

Question information

Language:
English Edit question
Status:
Expired
For:
OpenStack Compute (nova) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Kevin L. Mitchell (klmitch) said :
#1

Your problem isn't having Crypto/Random/random.py—that file is actually a requirement. (It generates better random numbers than the random number generator shipped with Python, which is the /usr/lib/python2.6/random.py.) That said, there's not enough information here to really figure out what your actual problem was…

I'd suggest you start off by starting over—particularly re-installing pycrypto and making sure python can import its random module (from shell, type "python", then at the ">>>" prompt, enter "from Crypto.Random import random" and make sure you don't get any errors). You might also want to start over with your nova installation; in particular, you need to have the glance package installed, and its client class should be importable (again, from the ">>>" prompt, try "from glance import client" and make sure you get no errors).

Finally, if you could let us know what versions of nova and glance you are working with, that will help…

Revision history for this message
Launchpad Janitor (janitor) said :
#2

This question was expired because it remained in the 'Needs information' state without activity for the last 15 days.