-1

Recently I ran into this error when I was trying devstack:

ERROR: openstackclient.shell Exception raised: python-neutronclient 2.3.9.40.g9ed73c0 is installed but python-neutronclient<3,>=2.3.6 is required by []

I did some investigation and found it perhaps is caused by python path issue. There are two suite of openstack client installations (such as python-neutronclient, python-novaclient, etc.) under /opt/stack/ directory and /usr/local/lib/python2.7/dist-packages directory. Take neutronclient as the example, I can find it under these two directories:

/opt/stack/python-neutronclient
and
/user/local/lib/python2.7/dist-packages/python-neutronclient

I found python would use the clients installed under /opt/stack:

>>> sys.path
['', '/opt/stack/python-keystoneclient', '/opt/stack/python-glanceclient', ..., '/opt/stack/heat', '/opt/stack/tempest', '/usr/lib/python2.7'....]

why python(devstack) doesn't use the packages under the /usr/local/lib/python2.7? There is a problem with the package under /opt/stack: the version information in the egg-info/PKG-INFO is not a valid PEP440 version, such as '2.3.10.dev47.g11deb7f', and that will cause devstack failed with the above error when provisioning keystone:

I didn't remember I explicitly set PYTHONPATH variable. How python or devstack set the /opt/stack/ before the default system python path? I checked the devstack source code but didn't find any useful information. Could anyone help to give some hints? thanks!

jin hui
  • 11
  • 3

1 Answers1

0

I found there are some *.pth files under /usr/local/lib/python2.7/dist-packages, and one of them include some items pointing to devstack default directories (i.e., /opt/stack/python-neutronclient, and so on). That's why those directories are taken as part of python path. There are also some egg-link files which point to openstack client project folders under /opt/stack, e.g.

~$ cat /usr/local/lib/python2.7/dist-package/python-neutronclient.egg-link
/opt/stack/python-neutronclient

So remove those egg link files, and remove the unwanted path items from the *.pth, then the problem will be fixed. Please be noted that you maybe keep the openstack client packages installed under /user/local/lib/python2.7/dist-packages updated to latest version. You can do this by manually executing 'pip install' or 'apt-get', or set 'LIBS_FROM_GIT' accordingly in devstack such as this:

LIBS_FROM_GIT=python-neutronclient,neutron-vpnaas,neutron-fwaas,neutron-lbaas,python-keystoneclient,python-glanceclient,python-novaclient,python-cinderclient

Thus devstack will git clone those openstack client projects into /opt/stack (by default) and then install those packages to /usr/local/lib/python2.7/dist-packages.

jin hui
  • 11
  • 3