Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pip upgrade #333

Merged
merged 1 commit into from
Jun 13, 2024
Merged

Conversation

cidrblock
Copy link
Collaborator

Add a command as a pre command to ensure pip is up todate.

This should help avoid AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'? when an older version of pip is used with python 3.12.

When tox is running from a python3.11 interpreter, the python3.11 wheel for pip is used even when setting up a virtual environment fro python3.12. This introduces a version that is broken with python3.12.

So, we'll just make sure pip is current as a precommand which should resolve the issue

@cidrblock cidrblock requested a review from a team as a code owner June 13, 2024 22:21
@cidrblock cidrblock requested review from ssbarnea and Qalthos and removed request for a team June 13, 2024 22:21
@github-actions github-actions bot added the bug This issue/PR relates to a bug. label Jun 13, 2024
@cidrblock
Copy link
Collaborator Author

tox --ansible -c ./tox-ansible.ini -e unit-py3.12-2.16 -vvv
ROOT: 90 D setup logging to NOTSET on pid 27408 [tox/report.py:221]
unit-py3.12-2.16: 188 I find interpreter for spec PythonSpec(major=3, minor=12) [virtualenv/discovery/builtin.py:58]
unit-py3.12-2.16: 189 I proposed PythonInfo(spec=CPython3.11.7.final.0-64, exe=/usr/bin/python3.11, platform=linux, version='3.11.7 (main, Jan 26 2024, 15:26:41) [GCC 8.5.0 20210514 (Red Hat 8.5.0-21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:65]
unit-py3.12-2.16: 189 D discover PATH[0]=/root/.vscode-server/bin/89de5a8d4d6205e5b11647eb6a74844ca23d2573/bin/remote-cli [virtualenv/discovery/builtin.py:111]
unit-py3.12-2.16: 189 D discover PATH[1]=/usr/local/sbin [virtualenv/discovery/builtin.py:111]
unit-py3.12-2.16: 189 D discover PATH[2]=/usr/local/bin [virtualenv/discovery/builtin.py:111]
unit-py3.12-2.16: 189 D discover PATH[3]=/usr/sbin [virtualenv/discovery/builtin.py:111]
unit-py3.12-2.16: 189 D discover PATH[4]=/usr/bin [virtualenv/discovery/builtin.py:111]
unit-py3.12-2.16: 190 D got python info of %s from (PosixPath('/usr/bin/python3.12'), PosixPath('/root/.local/share/virtualenv/py_info/1/f0d7a494a3f776233427cb85a7e198c7cf4913b50a203c6febc678cc4f5bf265.json')) [virtualenv/app_data/via_disk_folder.py:131]
unit-py3.12-2.16: 190 I proposed PathPythonInfo(spec=CPython3.12.1.final.0-64, exe=/usr/bin/python3.12, platform=linux, version='3.12.1 (main, Feb 21 2024, 10:25:11) [GCC 8.5.0 20210514 (Red Hat 8.5.0-21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:65]
unit-py3.12-2.16: 190 D accepted PathPythonInfo(spec=CPython3.12.1.final.0-64, exe=/usr/bin/python3.12, platform=linux, version='3.12.1 (main, Feb 21 2024, 10:25:11) [GCC 8.5.0 20210514 (Red Hat 8.5.0-21)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:67]
unit-py3.12-2.16: 192 D filesystem is case-sensitive [virtualenv/info.py:25]
unit-py3.12-2.16: 218 I create virtual environment via CPython3Posix(dest=/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16, clear=False, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:50]
unit-py3.12-2.16: 219 D create folder /workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/bin [virtualenv/util/path/_sync.py:12]
unit-py3.12-2.16: 219 D create folder /workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages [virtualenv/util/path/_sync.py:12]
unit-py3.12-2.16: 219 D create folder /workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib64/python3.12/site-packages [virtualenv/util/path/_sync.py:12]
unit-py3.12-2.16: 219 D write /workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:33]
unit-py3.12-2.16: 219 D         home = /usr/bin [virtualenv/create/pyenv_cfg.py:38]
unit-py3.12-2.16: 219 D         implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
unit-py3.12-2.16: 219 D         version_info = 3.12.1.final.0 [virtualenv/create/pyenv_cfg.py:38]
unit-py3.12-2.16: 219 D         virtualenv = 20.25.1 [virtualenv/create/pyenv_cfg.py:38]
unit-py3.12-2.16: 219 D         include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
unit-py3.12-2.16: 220 D         base-prefix = /usr [virtualenv/create/pyenv_cfg.py:38]
unit-py3.12-2.16: 220 D         base-exec-prefix = /usr [virtualenv/create/pyenv_cfg.py:38]
unit-py3.12-2.16: 220 D         base-executable = /usr/bin/python3.12 [virtualenv/create/pyenv_cfg.py:38]
unit-py3.12-2.16: 220 D symlink /usr/bin/python3.12 to /workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/bin/python [virtualenv/util/path/_sync.py:32]
unit-py3.12-2.16: 220 D create virtualenv import hook file /workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:91]
unit-py3.12-2.16: 220 D create /workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:94]
unit-py3.12-2.16: 220 D ============================== target debug ============================== [virtualenv/run/session.py:52]
unit-py3.12-2.16: 221 D debug via /workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/bin/python /usr/lib/python3.11/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:200]
unit-py3.12-2.16: 221 D {
  "sys": {
    "executable": "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/bin/python",
    "_base_executable": "/usr/bin/python3.12",
    "prefix": "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16",
    "base_prefix": "/usr",
    "real_prefix": null,
    "exec_prefix": "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16",
    "base_exec_prefix": "/usr",
    "path": [
      "/usr/lib64/python312.zip",
      "/usr/lib64/python3.12",
      "/usr/lib64/python3.12/lib-dynload",
      "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib64/python3.12/site-packages",
      "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages"
    ],
    "meta_path": [
      "<class '_virtualenv._Finder'>",
      "<class '_frozen_importlib.BuiltinImporter'>",
      "<class '_frozen_importlib.FrozenImporter'>",
      "<class '_frozen_importlib_external.PathFinder'>"
    ],
    "fs_encoding": "utf-8",
    "io_encoding": "utf-8"
  },
  "version": "3.12.1 (main, Feb 21 2024, 10:25:11) [GCC 8.5.0 20210514 (Red Hat 8.5.0-21)]",
  "makefile_filename": "/usr/lib64/python3.12/config-3.12-x86_64-linux-gnu/Makefile",
  "os": "<module 'os' (frozen)>",
  "site": "<module 'site' (frozen)>",
  "datetime": "<module 'datetime' from '/usr/lib64/python3.12/datetime.py'>",
  "math": "<module 'math' from '/usr/lib64/python3.12/lib-dynload/math.cpython-312-x86_64-linux-gnu.so'>",
  "json": "<module 'json' from '/usr/lib64/python3.12/json/__init__.py'>"
} [virtualenv/run/session.py:53]
unit-py3.12-2.16: 260 I add seed packages via FromAppData(download=False, pip=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv) [virtualenv/run/session.py:57]
unit-py3.12-2.16: 324 D install pip from wheel /usr/share/python3.11-wheels/pip-22.3.1-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:50]
unit-py3.12-2.16: 326 D copy directory /root/.local/share/virtualenv/wheel/3.12/image/1/CopyPipInstall/pip-22.3.1-py3-none-any/pip to /workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/pip [virtualenv/util/path/_sync.py:40]
unit-py3.12-2.16: 382 D copy directory /root/.local/share/virtualenv/wheel/3.12/image/1/CopyPipInstall/pip-22.3.1-py3-none-any/pip-22.3.1.dist-info to /workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/pip-22.3.1.dist-info [virtualenv/util/path/_sync.py:40]
unit-py3.12-2.16: 383 D copy /root/.local/share/virtualenv/wheel/3.12/image/1/CopyPipInstall/pip-22.3.1-py3-none-any/pip-22.3.1.virtualenv to /workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/pip-22.3.1.virtualenv [virtualenv/util/path/_sync.py:40]
unit-py3.12-2.16: 383 D generated console scripts pip-3.12 pip3 pip pip3.12 [virtualenv/seed/embed/via_app_data/pip_install/base.py:43]
unit-py3.12-2.16: 383 I add activators for Bash, CShell, Fish, Nushell, PowerShell, Python [virtualenv/run/session.py:63]
unit-py3.12-2.16: 385 D write /workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:33]
unit-py3.12-2.16: 386 D         home = /usr/bin [virtualenv/create/pyenv_cfg.py:38]
unit-py3.12-2.16: 386 D         implementation = CPython [virtualenv/create/pyenv_cfg.py:38]
unit-py3.12-2.16: 386 D         version_info = 3.12.1.final.0 [virtualenv/create/pyenv_cfg.py:38]
unit-py3.12-2.16: 386 D         virtualenv = 20.25.1 [virtualenv/create/pyenv_cfg.py:38]
unit-py3.12-2.16: 386 D         include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:38]
unit-py3.12-2.16: 386 D         base-prefix = /usr [virtualenv/create/pyenv_cfg.py:38]
unit-py3.12-2.16: 386 D         base-exec-prefix = /usr [virtualenv/create/pyenv_cfg.py:38]
unit-py3.12-2.16: 386 D         base-executable = /usr/bin/python3.12 [virtualenv/create/pyenv_cfg.py:38]
unit-py3.12-2.16: 389 W install_deps> python -I -m pip install molecule pytest pytest-ansible pytest-xdist https://github.com/ansible/ansible/archive/stable-2.16.tar.gz [tox/tox_env/api.py:427]
ERROR: Exception:
Traceback (most recent call last):
  File "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
    status = run_func(*args)
             ^^^^^^^^^^^^^^^
  File "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/pip/_internal/commands/install.py", line 326, in run
    session = self.get_default_session(options)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/pip/_internal/cli/req_command.py", line 98, in get_default_session
    self._session = self.enter_context(self._build_session(options))
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/pip/_internal/cli/req_command.py", line 125, in _build_session
    session = PipSession(
              ^^^^^^^^^^^
  File "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/pip/_internal/network/session.py", line 343, in __init__
    self.headers["User-Agent"] = user_agent()
                                 ^^^^^^^^^^^^
  File "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/pip/_internal/network/session.py", line 175, in user_agent
    setuptools_dist = get_default_environment().get_distribution("setuptools")
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 188, in get_distribution
    return next(matches, None)
           ^^^^^^^^^^^^^^^^^^^
  File "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 183, in <genexpr>
    matches = (
              ^
  File "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/pip/_internal/metadata/base.py", line 622, in iter_all_distributions
    for dist in self._iter_distributions():
  File "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 176, in _iter_distributions
    for dist in finder.find_eggs(location):
  File "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 144, in find_eggs
    yield from self._find_eggs_in_dir(location)
  File "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/pip/_internal/metadata/importlib/_envs.py", line 111, in _find_eggs_in_dir
    from pip._vendor.pkg_resources import find_distributions
  File "/workspaces/rpm_testing/myorg.myproject/.tox/unit-py3.12-2.16/lib/python3.12/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2164, in <module>
    register_finder(pkgutil.ImpImporter, find_on_path)
                    ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
unit-py3.12-2.16: 1288 C exit 2 (0.90 seconds) /workspaces/rpm_testing/myorg.myproject> python -I -m pip install molecule pytest pytest-ansible pytest-xdist https://github.com/ansible/ansible/archive/stable-2.16.tar.gz pid=27419 [tox/execute/api.py:280]
  unit-py3.12-2.16: FAIL code 2 (1.11 seconds)
  evaluation failed :( (1.20 seconds)
(unit-py3.12-2.16) [root@ansible-dev-container myorg.myproject]# 

@cidrblock
Copy link
Collaborator Author

The interesting line above is timestamped unit-py3.12-2.16: 324

@cidrblock cidrblock merged commit a0416f2 into ansible:main Jun 13, 2024
16 checks passed
@cidrblock cidrblock mentioned this pull request Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant