Virtualenv (and Tox) broken when run under python<3.6
cboylan at sapwetik.org
Mon Mar 2 21:09:56 UTC 2020
On Mon, Mar 2, 2020, at 9:12 AM, Clark Boylan wrote:
> A recent release of importlib-resources (1.1.0) no longer works on
> python2.7 or python3.5. The issue is they import typing's
> ContextManager which didn't exist until python3.6 . This means that
> python2 jobs and python3.5 jobs are currently unhappy if they need
> virtualenv. Unfortunately, many of our jobs use tox which uses
> One workaround being investigated  is to install
> importlib-resources==1.0.2 which does not try to use typing's
> ContextManager. If this is confirmed to work we will want to consider
> adding this change to the base job so that all jobs don't have to fix
> it separately.
We've landed a version of this workaround, https://review.opendev.org/710851, to the base job in opendev/base-jobs. By default this is the base job that all zuul jobs inherit from. This appears to fix use of virtualenv and tox within jobs that use the globally installed versions of these tools.
If you run a nested version of the tools (DIB chroot, containers, etc) you'll need to address this issue within that separate context.
> Note the version of python here is the one used to run virtualenv not
> the version of python being installed into the virtualenv. This means
> python3.6 running virtualenv to create a python2 virtualenv should be
> fine. But python3.5 running virtualenv to create a python3.6 env would
> not be fine.
>  https://gitlab.com/python-devs/importlib_resources/issues/83
>  https://review.opendev.org/#/c/710729/
More information about the openstack-discuss