Kyle Pericak

"It works in my environment."

Thu 25 June 2020

OpenStack: Fixing the CLI (python2) error: No module named queue

Posted by Kyle Pericak in cloud   


# replace "import queue" with:
from multiprocessing import Queue as queue

Steps to fix

In Ubuntu 18.04 you'd typically install the openstack CLI client like this:

pip install python-openstackclient

Sadly, this installs a broken version of the client. If you try and run any command you get a stack trace:

Traceback (most recent call last):
  File "/usr/local/bin/openstack", line 6, in <module>
    from import main
  File "/usr/local/lib/python2.7/dist-packages/openstackclient/", line 24, in <module>
    from osc_lib import shell
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/", line 33, in <module>
    from osc_lib.cli import client_config as cloud_config
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/cli/", line 18, in <module>
    from openstack.config import exceptions as sdk_exceptions
  File "/usr/local/lib/python2.7/dist-packages/openstack/", line 16, in <module>
    import openstack.config
  File "/usr/local/lib/python2.7/dist-packages/openstack/config/", line 17, in <module>
    from openstack.config.loader import OpenStackConfig  # noqa
  File "/usr/local/lib/python2.7/dist-packages/openstack/config/", line 33, in <module>
    from openstack.config import cloud_region
  File "/usr/local/lib/python2.7/dist-packages/openstack/config/", line 44, in <module>
    from openstack import proxy
  File "/usr/local/lib/python2.7/dist-packages/openstack/", line 24, in <module>
    from openstack import resource
  File "/usr/local/lib/python2.7/dist-packages/openstack/", line 49, in <module>
    from openstack import utils
  File "/usr/local/lib/python2.7/dist-packages/openstack/", line 13, in <module>
    import queue
ImportError: No module named queue

To fix it, replace import queue with from multiprocessing import Queue as queue everywhere that it's called.

In my case:

  • usr/local/lib/python2.7/dist-packages/openstack/ - line 13
  • /usr/local/lib/python2.7/dist-packages/openstack/cloud/ - line 14

Javascript appears to be disabled. Comments can't load.