pip install tripleo-repos: DistributionNotFound

Bug #1826452 reported by Rafael Folco
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
Critical
Sorin Sbarnea

Bug Description

DistributionNotFound

2019-04-25 18:33:35.793928 | TASK [tripleo-repos : pip install tripleo-repos]
2019-04-25 18:33:36.275720 | primary | ERROR
2019-04-25 18:33:36.276103 | primary | {
2019-04-25 18:33:36.276171 | primary | "msg": "\n:stderr: Traceback (most recent call last):\n File \"/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py\", line 583, in _build_master\n ws.require(__requires__)\n File \"/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py\", line 900, in require\n needed = self.resolve(parse_requirements(requirements))\n File \"/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py\", line 791, in resolve\n raise VersionConflict(dist, req).with_context(dependent_req)\npkg_resources.VersionConflict: (virtualenv 16.5.0 (/usr/local/lib/python3.6/site-packages), Requirement.parse('virtualenv==16.0.0'))\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/usr/bin/virtualenv-3\", line 6, in <module>\n from pkg_resources import load_entry_point\n File \"/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py\", line 3241, in <module>\n @_call_aside\n File \"/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py\", line 3225, in _call_aside\n f(*args, **kwargs)\n File \"/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py\", line 3254, in _initialize_master_working_set\n working_set = WorkingSet._build_master()\n File \"/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py\", line 585, in _build_master\n return cls._build_from_requirements(__requires__)\n File \"/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py\", line 598, in _build_from_requirements\n dists = ws.resolve(reqs, Environment())\n File \"/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py\", line 786, in resolve\n raise DistributionNotFound(req, requirers)\npkg_resources.DistributionNotFound: The 'virtualenv==16.0.0' distribution was not found and is required by the application\n"

http://logs.rdoproject.org/openstack-periodic-master/opendev.org/openstack/tripleo-
ci/master/periodic-tripleo-fedora-28-master-containers-build-push/69d4144/job-output.txt.gz

Sorin Sbarnea (ssbarnea)
Changed in tripleo:
assignee: nobody → Sorin Sbarnea (ssbarnea)
Revision history for this message
Sorin Sbarnea (ssbarnea) wrote :

With help from jpena I was able to identify the root cause of that issue: the fedora-28 image used by rdo zool is broken:

$ virtualenv-3 --help
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 791, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (virtualenv 16.5.0 (/usr/local/lib/python3.6/site-packages), Requirement.parse('virtualenv==16.0.0'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/virtualenv-3", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3241, in <module>
    @_call_aside
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3225, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3254, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 585, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'virtualenv==16.0.0' distribution was not found and is required by the application

This was caused by installation of a newer version pip as root from pypi, one that overriden the system version and also broke virtualenv.

Similar example https://github.com/certbot/certbot/issues/3730

This can only be fixed by fixing the image and avoiding to mess the operating system.

PS. If desired, wewer version of pip can safely be installed using `--user`, to avoid messing with the operating system one. If pip and other packages are installed at user level (zuul? root?) it should be safe.

Revision history for this message
Javier Peña (jpena-c) wrote :
Revision history for this message
Sorin Sbarnea (ssbarnea) wrote :

Yep, this is what we need to fix, mainly bringing the image to a supported version.

Revision history for this message
Javier Peña (jpena-c) wrote :

I have proposed https://softwarefactory-project.io/r/15449 with a workaround for the Fedora 28 image in RDO's Zuul.

Revision history for this message
Paul Belanger (pabelanger) wrote :

You likely want to update nodepool and set the following for fedora images:

  DIB_INSTALLTYPE_pip_and_virtualenv=package

That should default everything to use the distro packages for virtualenv / pip

Revision history for this message
Sorin Sbarnea (ssbarnea) wrote :

https://softwarefactory-project.io/r/#/c/15462/ just merged so now I am going to test if this fixed the issue for us.

Revision history for this message
Sorin Sbarnea (ssbarnea) wrote :
Revision history for this message
Rafael Folco (rafaelfolco) wrote :
Changed in tripleo:
status: Triaged → Fix Committed
wes hayutin (weshayutin)
Changed in tripleo:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.