Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Version conflict issue with Python packaging module

I was deploying OpenStack Newton devstack using stack.sh

I ran into the following issue :

Processing /opt/stack/requirements
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-2UrvLp-build/setup.py", line 29, in <module>
        pbr=True)
      File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/opt/stack/requirements/.venv/local/lib/python2.7/site-packages/setuptools/dist.py", line 320, in __init__
        _Distribution.__init__(self, attrs)
      File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
        self.finalize_options()
      File "/opt/stack/requirements/.venv/local/lib/python2.7/site-packages/setuptools/dist.py", line 386, in finalize_options
        ep.require(installer=self.fetch_build_egg)
      File "/opt/stack/requirements/.venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2318, in require
        items = working_set.resolve(reqs, env, installer, extras=self.extras)
      File "/opt/stack/requirements/.venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 859, in resolve
        raise VersionConflict(dist, req).with_context(dependent_req)
    pkg_resources.VersionConflict: (packaging 16.7 (/opt/stack/requirements/.venv/lib/python2.7/site-packages), Requirement.parse('packaging>=16.8'))

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-2UrvLp-build/
+inc/python:pip_install:1                  exit_trap
+./stack.sh:exit_trap:487                  local r=1
++./stack.sh:exit_trap:488                  jobs -p
+./stack.sh:exit_trap:488                  jobs=
+./stack.sh:exit_trap:491                  [[ -n '' ]]
+./stack.sh:exit_trap:497                  kill_spinner
+./stack.sh:kill_spinner:383               '[' '!' -z '' ']'
+./stack.sh:exit_trap:499                  [[ 1 -ne 0 ]]
+./stack.sh:exit_trap:500                  echo 'Error on exit'
Error on exit
+./stack.sh:exit_trap:501                  generate-subunit 1486635146 55 fail
+./stack.sh:exit_trap:502                  [[ -z /opt/stack/logs ]]
+./stack.sh:exit_trap:505                  /home/demo/devstack/tools/worlddump.py -d /opt/stack/logs
World dumping... see /opt/stack/logs/worlddump-2017-02-09-101322.txt for details
+./stack.sh:exit_trap:511                  exit 1

Looks like there is a version conflict for a package called 'packaging'.

Here's what I did - > Tried uninstall and re-installing the package by doing the following :

pip uninstall packaging

pip install --upgrade packaging

But it doesn't really help and I get the same error again.

Please help me resolve this issue, kindly be specific which command I should execute and in which directory.

like image 495
CodePlorer Avatar asked Apr 21 '26 03:04

CodePlorer


1 Answers

I got the exact same error with devstack, here's how to fix it:

First add a global setting to log everything pip is doing. Create /etc/pip.conf with the following contents:

[global]
log = /var/log/pip.log

Then run:

sudo touch /var/log/pip.log
sudo chmod a+rw /var/log/pip.log

to make sure pip can always write to this file.

Then watch the changes related to the packaging package with:

tail -f /var/log/pip.log |grep packaging

And in parallel relaunch ./stack.sh .

At some point, in the pip logs you should see a line similar to:

Setting packaging===16.7 (from -c /opt/stack/requirements/upper-constraints.txt ...

This shows you where this requirement comes from, in this case it is from the /opt/stack/requirements/upper-constraints.txt file.

You can then manually edit the file in question to change this requirement to remove the conflict. In my case, I replaced:

packaging===16.7

by

packaging>=16.8

in /opt/stack/requirements/upper-constraints.txt

And after that the devstack installation completed without issues.


TL;DR

cd /opt/stack/requirements/
sed -i.bak s/packaging===16.7/packaging>=16.8/g upper-contraints.txt
like image 112
JayTe Avatar answered Apr 23 '26 16:04

JayTe