Fixes: rhbz#2328956
Since the fix for rhbz#2272958 landed in EPEL 9,
it is not possible to use `virtualenv --seeder pip --python=python3.12`
as it fails with:
$ virtualenv -vvvv --seeder pip --python=python3.12 venv
...
86 add seed packages via PipInvoke(download=False, pip=bundle) [INFO session:55]
167 pip seed by running: /builddir/venv/bin/python -m pip -q install --only-binary :all: --disable-pip-version-check --no-index pip==23.2.1 --find-links /usr/share/python3.12-wheels env of {'SHELL': '/bin/bash', 'HISTCONTROL': 'ignoredups', 'HISTSIZE': '1000', 'HOSTNAME': '815503ada5e04dfd9391f4c02f5e0aa2', 'container_host_version_id': '41', 'PWD': '/builddir', 'LOGNAME': 'mockbuild', 'container': 'systemd-nspawn', 'HOME': '/builddir', 'LANG': 'C.UTF-8', 'LS_COLORS': 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.m4a=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.oga=01;36:*.opus=01;36:*.spx=01;36:*.xspf=01;36:', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'TERM': 'vt100', 'USER': 'mockbuild', 'NOTIFY_SOCKET': '/run/host/notify', 'SHLVL': '1', 'container_host_id': 'fedora', 'PS1': '<mock-chroot> \\s-\\v\\$ ', 'DEBUGINFOD_URLS': 'https://debuginfod.centos.org/ ', 'which_declare': 'declare -f', 'container_host_variant_id': 'xfce', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin', 'MAIL': '/var/spool/mail/mockbuild', 'container_uuid': 'cb2fba57-8768-4fdc-bda2-55c92f437ac2', 'OLDPWD': '/builddir', 'BASH_FUNC_which%%': '() { ( alias;\n eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@\n}', '_': '/usr/bin/virtualenv', 'PLAT': 'linux-x86_64', 'PIP_USE_WHEEL': '1', 'PIP_USER': '0', 'PIP_NO_INPUT': '1', 'PYTHONPATH': '/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl'} [DEBUG pip_invoke:26]
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/__main__.py", line 29, in <module>
File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/_internal/cli/main.py", line 9, in <module>
File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/_internal/cli/autocompletion.py", line 10, in <module>
File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/_internal/cli/main_parser.py", line 8, in <module>
File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/_internal/cli/cmdoptions.py", line 23, in <module>
File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/_internal/cli/parser.py", line 12, in <module>
File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/_internal/configuration.py", line 20, in <module>
File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/_internal/exceptions.py", line 7, in <module>
File "/usr/share/python3-wheels/pip-21.3.1-py3-none-any.whl/pip/_vendor/pkg_resources/__init__.py", line 2164, in <module>
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
371 RuntimeError: failed seed with code 1 [ERROR __main__:61]
This changes the patch in a way that makes both work.
(cherry picked from commit e63113aa81b4a1e1e8293b1884cba61c7e23e610)
- Fixes: rhbz#2272958
Up until now, when creating virtual environments for old Pythons (such as 3.6 or 2.7),
the wheels were searched in the directories specific for the target Python version.
As a result, old pip for old Python (e.g. pip 18.1 for Python 3.6)
was run with the system Python (e.g. 3.12), which could lead to crashes,
because the code in old pip was not compatible yet with newer Pythons.
For details, see https://bugzilla.redhat.com/2272958
In RHEL 9, the wheels are located in:
- For Python 3.9: /usr/share/python3-wheels
- For Python 3.11: /usr/share/python3.11-wheels
This changes our patch to use RPM packaged wheels from the appropriate directories.
Is should work with future Python versions as well, assuming nothing changes in RHEL.