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

Infinite loop over automatically provisioned requirement with unmatched environment marker #3136

Open
jaraco opened this issue Oct 10, 2023 · 1 comment
Labels
help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.

Comments

@jaraco
Copy link

jaraco commented Oct 10, 2023

Issue

When attempting to auto-provision a tox environment with an unmet requirement masked by an environment marker.

Environment

Provide at least:

  • OS: macOS
Output of pip list of the host Python, where tox is installed
 draft @ pipx runpip tox list
Package       Version
------------- -------
cachetools    5.3.1
chardet       5.2.0
colorama      0.4.6
distlib       0.3.7
filelock      3.12.4
packaging     23.2
pip           23.2.1
platformdirs  3.11.0
pluggy        1.3.0
pyproject-api 1.6.1
setuptools    68.2.2
tox           4.11.3
virtualenv    20.24.5
wheel         0.41.2

Output of running tox

Output of tox -rvv
 draft @ tox -rvv
ROOT: 139 W will run in automatically provisioned tox, host /Users/jaraco/.local/pipx/venvs/tox/bin/python is missing [requires (has)]: virtualenv<20.22.0; python_version < "3.8" (20.24.5) [tox/provision.py:121]
ROOT: 142 I find interpreter for spec PythonSpec(path=/Users/jaraco/.local/pipx/venvs/tox/bin/python) [virtualenv/discovery/builtin.py:58]
ROOT: 143 D got python info of %s from (PosixPath('/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/bin/python3.12'), PosixPath('/Users/jaraco/Library/Application Support/virtualenv/py_info/1/dc0470049ffa4c4445e0d1408dc48035d7e791b12d0bd6869b4620555a540b19.json')) [virtualenv/app_data/via_disk_folder.py:131]
ROOT: 144 D got python info of %s from (PosixPath('/opt/homebrew/opt/[email protected]/bin/python3.12'), PosixPath('/Users/jaraco/Library/Application Support/virtualenv/py_info/1/5a4cf2bb741256526a6955dc3fec99df2e3ad77a4d6165ea0a4c3b0477c721b2.json')) [virtualenv/app_data/via_disk_folder.py:131]
ROOT: 144 I proposed PythonInfo(spec=CPython3.12.0.final.0-64, system=/opt/homebrew/opt/[email protected]/bin/python3.12, exe=/Users/jaraco/.local/pipx/venvs/tox/bin/python, platform=darwin, version='3.12.0 (main, Oct  5 2023, 15:44:07) [Clang 14.0.3 (clang-1403.0.22.14.1)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:65]
ROOT: 144 D accepted PythonInfo(spec=CPython3.12.0.final.0-64, system=/opt/homebrew/opt/[email protected]/bin/python3.12, exe=/Users/jaraco/.local/pipx/venvs/tox/bin/python, platform=darwin, version='3.12.0 (main, Oct  5 2023, 15:44:07) [Clang 14.0.3 (clang-1403.0.22.14.1)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:67]
ROOT: 145 D filesystem is not case-sensitive [virtualenv/info.py:26]
ROOT: 167 I will run in a automatically provisioned python environment under /Users/jaraco/draft/.tox/.tox/bin/python [tox/provision.py:142]
ROOT: 167 I create virtual environment via CPython3macOsBrew(dest=/Users/jaraco/draft/.tox/.tox, clear=False, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:50]
ROOT: 167 D create folder /Users/jaraco/draft/.tox/.tox/bin [virtualenv/util/path/_sync.py:12]
ROOT: 168 D create folder /Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages [virtualenv/util/path/_sync.py:12]
ROOT: 168 D write /Users/jaraco/draft/.tox/.tox/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:32]
ROOT: 168 D     home = /opt/homebrew/opt/[email protected]/bin [virtualenv/create/pyenv_cfg.py:36]
ROOT: 168 D     implementation = CPython [virtualenv/create/pyenv_cfg.py:36]
ROOT: 168 D     version_info = 3.12.0.final.0 [virtualenv/create/pyenv_cfg.py:36]
ROOT: 168 D     virtualenv = 20.24.5 [virtualenv/create/pyenv_cfg.py:36]
ROOT: 168 D     include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:36]
ROOT: 168 D     base-prefix = /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12 [virtualenv/create/pyenv_cfg.py:36]
ROOT: 168 D     base-exec-prefix = /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12 [virtualenv/create/pyenv_cfg.py:36]
ROOT: 168 D     base-executable = /opt/homebrew/opt/[email protected]/bin/python3.12 [virtualenv/create/pyenv_cfg.py:36]
ROOT: 168 D symlink /opt/homebrew/opt/[email protected]/bin/python3.12 to /Users/jaraco/draft/.tox/.tox/bin/python [virtualenv/util/path/_sync.py:32]
ROOT: 169 D create virtualenv import hook file /Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:91]
ROOT: 169 D create /Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:94]
ROOT: 169 D ============================== target debug ============================== [virtualenv/run/session.py:52]
ROOT: 169 D debug via /Users/jaraco/draft/.tox/.tox/bin/python /Users/jaraco/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:200]
ROOT: 169 D {
  "sys": {
    "executable": "/Users/jaraco/draft/.tox/.tox/bin/python",
    "_base_executable": "/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/bin/python3.12",
    "prefix": "/Users/jaraco/draft/.tox/.tox",
    "base_prefix": "/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12",
    "real_prefix": null,
    "exec_prefix": "/Users/jaraco/draft/.tox/.tox",
    "base_exec_prefix": "/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12",
    "path": [
      "/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python312.zip",
      "/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12",
      "/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload",
      "/Users/jaraco/draft/.tox/.tox/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.0 (main, Oct  5 2023, 15:44:07) [Clang 14.0.3 (clang-1403.0.22.14.1)]",
  "makefile_filename": "/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12/lib/python3.12/config-3.12-darwin/Makefile",
  "os": "<module 'os' (frozen)>",
  "site": "<module 'site' (frozen)>",
  "datetime": "<module 'datetime' from '/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12/datetime.py'>",
  "math": "<module 'math' from '/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload/math.cpython-312-darwin.so'>",
  "json": "<module 'json' from '/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/__init__.py'>"
} [virtualenv/run/session.py:53]
ROOT: 202 I add seed packages via FromAppData(download=False, pip=bundle, via=copy, app_data_dir=/Users/jaraco/Library/Application Support/virtualenv) [virtualenv/run/session.py:57]
ROOT: 204 D got embed update of distribution %s from ('pip', PosixPath('/Users/jaraco/Library/Application Support/virtualenv/wheel/3.12/embed/3/pip.json')) [virtualenv/app_data/via_disk_folder.py:131]
ROOT: 206 D install pip from wheel /Users/jaraco/.local/pipx/venvs/tox/lib/python3.12/site-packages/virtualenv/seed/wheels/embed/pip-23.2.1-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:49]
ROOT: 206 D copy /Users/jaraco/Library/Application Support/virtualenv/wheel/3.12/image/1/CopyPipInstall/pip-23.2.1-py3-none-any/pip-23.2.1.virtualenv to /Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/pip-23.2.1.virtualenv [virtualenv/util/path/_sync.py:40]
ROOT: 207 D copy directory /Users/jaraco/Library/Application Support/virtualenv/wheel/3.12/image/1/CopyPipInstall/pip-23.2.1-py3-none-any/pip to /Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/pip [virtualenv/util/path/_sync.py:40]
ROOT: 328 D copy directory /Users/jaraco/Library/Application Support/virtualenv/wheel/3.12/image/1/CopyPipInstall/pip-23.2.1-py3-none-any/pip-23.2.1.dist-info to /Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/pip-23.2.1.dist-info [virtualenv/util/path/_sync.py:40]
ROOT: 331 D generated console scripts pip3.12 pip-3.12 pip3 pip [virtualenv/seed/embed/via_app_data/pip_install/base.py:43]
ROOT: 331 I add activators for Bash, CShell, Fish, Nushell, PowerShell, Python [virtualenv/run/session.py:63]
ROOT: 333 D write /Users/jaraco/draft/.tox/.tox/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:32]
ROOT: 333 D     home = /opt/homebrew/opt/[email protected]/bin [virtualenv/create/pyenv_cfg.py:36]
ROOT: 333 D     implementation = CPython [virtualenv/create/pyenv_cfg.py:36]
ROOT: 333 D     version_info = 3.12.0.final.0 [virtualenv/create/pyenv_cfg.py:36]
ROOT: 333 D     virtualenv = 20.24.5 [virtualenv/create/pyenv_cfg.py:36]
ROOT: 333 D     include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:36]
ROOT: 333 D     base-prefix = /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12 [virtualenv/create/pyenv_cfg.py:36]
ROOT: 333 D     base-exec-prefix = /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12 [virtualenv/create/pyenv_cfg.py:36]
ROOT: 333 D     base-executable = /opt/homebrew/opt/[email protected]/bin/python3.12 [virtualenv/create/pyenv_cfg.py:36]
ROOT: 335 W install_deps> python -I -m pip install tox 'virtualenv<20.22.0; python_version < "3.8"' [tox/tox_env/api.py:427]
Ignoring virtualenv: markers 'python_version < "3.8"' don't match your environment
Collecting tox
  Obtaining dependency information for tox from https://files.pythonhosted.org/packages/f5/f9/963052e8b825645c54262dce7b7c88691505e3b9ee10a3e3667711eaaf21/tox-4.11.3-py3-none-any.whl.metadata
  Using cached tox-4.11.3-py3-none-any.whl.metadata (5.0 kB)
Collecting cachetools>=5.3.1 (from tox)
  Obtaining dependency information for cachetools>=5.3.1 from https://files.pythonhosted.org/packages/a9/c9/c8a7710f2cedcb1db9224fdd4d8307c9e48cbddc46c18b515fefc0f1abbe/cachetools-5.3.1-py3-none-any.whl.metadata
  Using cached cachetools-5.3.1-py3-none-any.whl.metadata (5.2 kB)
Collecting chardet>=5.2 (from tox)
  Obtaining dependency information for chardet>=5.2 from https://files.pythonhosted.org/packages/38/6f/f5fbc992a329ee4e0f288c1fe0e2ad9485ed064cac731ed2fe47dcc38cbf/chardet-5.2.0-py3-none-any.whl.metadata
  Using cached chardet-5.2.0-py3-none-any.whl.metadata (3.4 kB)
Collecting colorama>=0.4.6 (from tox)
  Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting filelock>=3.12.3 (from tox)
  Obtaining dependency information for filelock>=3.12.3 from https://files.pythonhosted.org/packages/5e/5d/97afbafd9d584ff1b45fcb354a479a3609bd97f912f8f1f6c563cb1fae21/filelock-3.12.4-py3-none-any.whl.metadata
  Using cached filelock-3.12.4-py3-none-any.whl.metadata (2.8 kB)
Collecting packaging>=23.1 (from tox)
  Obtaining dependency information for packaging>=23.1 from https://files.pythonhosted.org/packages/ec/1a/610693ac4ee14fcdf2d9bf3c493370e4f2ef7ae2e19217d7a237ff42367d/packaging-23.2-py3-none-any.whl.metadata
  Using cached packaging-23.2-py3-none-any.whl.metadata (3.2 kB)
Collecting platformdirs>=3.10 (from tox)
  Obtaining dependency information for platformdirs>=3.10 from https://files.pythonhosted.org/packages/56/29/3ec311dc18804409ecf0d2b09caa976f3ae6215559306b5b530004e11156/platformdirs-3.11.0-py3-none-any.whl.metadata
  Using cached platformdirs-3.11.0-py3-none-any.whl.metadata (11 kB)
Collecting pluggy>=1.3 (from tox)
  Obtaining dependency information for pluggy>=1.3 from https://files.pythonhosted.org/packages/05/b8/42ed91898d4784546c5f06c60506400548db3f7a4b3fb441cba4e5c17952/pluggy-1.3.0-py3-none-any.whl.metadata
  Using cached pluggy-1.3.0-py3-none-any.whl.metadata (4.3 kB)
Collecting pyproject-api>=1.6.1 (from tox)
  Obtaining dependency information for pyproject-api>=1.6.1 from https://files.pythonhosted.org/packages/cf/b4/39eea50542e50e93876ebc09c4349a9c9eee9f6b9c9d30f88c7dc5433db8/pyproject_api-1.6.1-py3-none-any.whl.metadata
  Using cached pyproject_api-1.6.1-py3-none-any.whl.metadata (2.8 kB)
Collecting virtualenv>=20.24.3 (from tox)
  Obtaining dependency information for virtualenv>=20.24.3 from https://files.pythonhosted.org/packages/4e/8b/f0d3a468c0186c603217a6656ea4f49259630e8ed99558501d92f6ff7dc3/virtualenv-20.24.5-py3-none-any.whl.metadata
  Using cached virtualenv-20.24.5-py3-none-any.whl.metadata (4.5 kB)
Collecting distlib<1,>=0.3.7 (from virtualenv>=20.24.3->tox)
  Obtaining dependency information for distlib<1,>=0.3.7 from https://files.pythonhosted.org/packages/43/a0/9ba967fdbd55293bacfc1507f58e316f740a3b231fc00e3d86dc39bc185a/distlib-0.3.7-py2.py3-none-any.whl.metadata
  Using cached distlib-0.3.7-py2.py3-none-any.whl.metadata (5.1 kB)
Using cached tox-4.11.3-py3-none-any.whl (153 kB)
Using cached cachetools-5.3.1-py3-none-any.whl (9.3 kB)
Using cached chardet-5.2.0-py3-none-any.whl (199 kB)
Using cached filelock-3.12.4-py3-none-any.whl (11 kB)
Using cached packaging-23.2-py3-none-any.whl (53 kB)
Using cached platformdirs-3.11.0-py3-none-any.whl (17 kB)
Using cached pluggy-1.3.0-py3-none-any.whl (18 kB)
Using cached pyproject_api-1.6.1-py3-none-any.whl (12 kB)
Using cached virtualenv-20.24.5-py3-none-any.whl (3.7 MB)
Using cached distlib-0.3.7-py2.py3-none-any.whl (468 kB)
Installing collected packages: distlib, pluggy, platformdirs, packaging, filelock, colorama, chardet, cachetools, virtualenv, pyproject-api, tox
Successfully installed cachetools-5.3.1 chardet-5.2.0 colorama-0.4.6 distlib-0.3.7 filelock-3.12.4 packaging-23.2 platformdirs-3.11.0 pluggy-1.3.0 pyproject-api-1.6.1 tox-4.11.3 virtualenv-20.24.5
ROOT: 2220 I exit 0 (1.88 seconds) /Users/jaraco/draft> python -I -m pip install tox 'virtualenv<20.22.0; python_version < "3.8"' pid=23815 [tox/execute/api.py:279]
ROOT: 2221 W provision> .tox/.tox/bin/python -m tox -rvv [tox/tox_env/api.py:427]
ROOT: 99 W will run in automatically provisioned tox, host /Users/jaraco/draft/.tox/.tox/bin/python is missing [requires (has)]: virtualenv<20.22.0; python_version < "3.8" (20.24.5) [tox/provision.py:121]
ROOT: 101 I find interpreter for spec PythonSpec(path=/Users/jaraco/draft/.tox/.tox/bin/python) [virtualenv/discovery/builtin.py:58]
ROOT: 102 D got python info of %s from (PosixPath('/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/bin/python3.12'), PosixPath('/Users/jaraco/Library/Application Support/virtualenv/py_info/1/dc0470049ffa4c4445e0d1408dc48035d7e791b12d0bd6869b4620555a540b19.json')) [virtualenv/app_data/via_disk_folder.py:131]
ROOT: 102 D got python info of %s from (PosixPath('/opt/homebrew/opt/[email protected]/bin/python3.12'), PosixPath('/Users/jaraco/Library/Application Support/virtualenv/py_info/1/5a4cf2bb741256526a6955dc3fec99df2e3ad77a4d6165ea0a4c3b0477c721b2.json')) [virtualenv/app_data/via_disk_folder.py:131]
ROOT: 102 I proposed PythonInfo(spec=CPython3.12.0.final.0-64, system=/opt/homebrew/opt/[email protected]/bin/python3.12, exe=/Users/jaraco/draft/.tox/.tox/bin/python, platform=darwin, version='3.12.0 (main, Oct  5 2023, 15:44:07) [Clang 14.0.3 (clang-1403.0.22.14.1)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:65]
ROOT: 103 D accepted PythonInfo(spec=CPython3.12.0.final.0-64, system=/opt/homebrew/opt/[email protected]/bin/python3.12, exe=/Users/jaraco/draft/.tox/.tox/bin/python, platform=darwin, version='3.12.0 (main, Oct  5 2023, 15:44:07) [Clang 14.0.3 (clang-1403.0.22.14.1)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:67]
ROOT: 104 D filesystem is not case-sensitive [virtualenv/info.py:26]
ROOT: 118 I will run in a automatically provisioned python environment under /Users/jaraco/draft/.tox/.tox/bin/python [tox/provision.py:142]
ROOT: 118 W remove tox env folder /Users/jaraco/draft/.tox/.tox [tox/tox_env/api.py:322]
ROOT: 216 I create virtual environment via CPython3macOsBrew(dest=/Users/jaraco/draft/.tox/.tox, clear=False, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:50]
ROOT: 217 D create folder /Users/jaraco/draft/.tox/.tox/bin [virtualenv/util/path/_sync.py:12]
ROOT: 217 D create folder /Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages [virtualenv/util/path/_sync.py:12]
ROOT: 217 D write /Users/jaraco/draft/.tox/.tox/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:32]
ROOT: 217 D     home = /opt/homebrew/opt/[email protected]/bin [virtualenv/create/pyenv_cfg.py:36]
ROOT: 217 D     implementation = CPython [virtualenv/create/pyenv_cfg.py:36]
ROOT: 217 D     version_info = 3.12.0.final.0 [virtualenv/create/pyenv_cfg.py:36]
ROOT: 217 D     virtualenv = 20.24.5 [virtualenv/create/pyenv_cfg.py:36]
ROOT: 217 D     include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:36]
ROOT: 217 D     base-prefix = /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12 [virtualenv/create/pyenv_cfg.py:36]
ROOT: 217 D     base-exec-prefix = /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12 [virtualenv/create/pyenv_cfg.py:36]
ROOT: 217 D     base-executable = /opt/homebrew/opt/[email protected]/bin/python3.12 [virtualenv/create/pyenv_cfg.py:36]
ROOT: 217 D symlink /opt/homebrew/opt/[email protected]/bin/python3.12 to /Users/jaraco/draft/.tox/.tox/bin/python [virtualenv/util/path/_sync.py:32]
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/tox/__main__.py", line 6, in <module>
  File "/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/tox/run.py", line 19, in run
  File "/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/tox/run.py", line 41, in main
  File "/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/tox/provision.py", line 122, in provision
  File "/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/tox/provision.py", line 144, in run_provision
  File "/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/tox/tox_env/api.py", line 247, in setup
  File "/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/tox/tox_env/python/runner.py", line 107, in _setup_env
  File "/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/tox/tox_env/python/api.py", line 199, in _setup_env
  File "/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/tox/tox_env/python/api.py", line 206, in ensure_python_env
  File "/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/api.py", line 129, in create_python_env
  File "/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/virtualenv/run/session.py", line 44, in run
  File "/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/virtualenv/run/session.py", line 51, in _create
  File "/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/virtualenv/create/creator.py", line 158, in run
  File "/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/virtualenv/create/via_global_ref/builtin/via_global_self_do.py", line 99, in create
  File "/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/virtualenv/create/via_global_ref/api.py", line 85, in create
  File "/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/virtualenv/create/via_global_ref/api.py", line 88, in install_patch
  File "/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/virtualenv/create/via_global_ref/api.py", line 100, in env_patch_text
  File "/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12/pathlib.py", line 1028, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors) as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12/pathlib.py", line 1014, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/Users/jaraco/draft/.tox/.tox/lib/python3.12/site-packages/virtualenv/create/via_global_ref/_virtualenv.py'
Traceback (most recent call last):
  File "/Users/jaraco/.local/bin/tox", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/Users/jaraco/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/run.py", line 19, in run
    result = main(sys.argv[1:] if args is None else args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/run.py", line 41, in main
    result = provision(state)
             ^^^^^^^^^^^^^^^^
  File "/Users/jaraco/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/provision.py", line 122, in provision
    return run_provision(provision_tox_env, state)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/provision.py", line 150, in run_provision
    outcome = tox_env.execute(cmd=args, stdin=StdinSource.user_only(), show=True, run_id="provision", cwd=Path.cwd())
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/api.py", line 389, in execute
    with self.execute_async(cmd, stdin, show, cwd, run_id, executor) as status:
  File "/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 144, in __exit__
    next(self.gen)
  File "/Users/jaraco/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/api.py", line 443, in execute_async
    self._log_execute(request, execute_status)
  File "/Users/jaraco/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/api.py", line 449, in _log_execute
    self._write_execute_log(self.name, self.env_log_dir / f"{self._log_id}-{request.run_id}.log", request, status)
  File "/Users/jaraco/.local/pipx/venvs/tox/lib/python3.12/site-packages/tox/tox_env/api.py", line 453, in _write_execute_log
    with log_file.open("wt", encoding="utf-8") as file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12/pathlib.py", line 1014, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/Users/jaraco/draft/.tox/.tox/log/2-provision.log'

That's strange, because that's not the same error that occurs without -rvv.

Output of tox
 draft @ tox
ROOT: will run in automatically provisioned tox, host /Users/jaraco/.local/pipx/venvs/tox/bin/python is missing [requires (has)]: virtualenv<20.22.0; python_version < "3.8" (20.24.5)
ROOT: install_deps> python -I -m pip install tox 'virtualenv<20.22.0; python_version < "3.8"'
ROOT: provision> .tox/.tox/bin/python -m tox
ROOT: will run in automatically provisioned tox, host /Users/jaraco/draft/.tox/.tox/bin/python is missing [requires (has)]: virtualenv<20.22.0; python_version < "3.8" (20.24.5)
ROOT: provision> .tox/.tox/bin/python -m tox
ROOT: will run in automatically provisioned tox, host /Users/jaraco/draft/.tox/.tox/bin/python is missing [requires (has)]: virtualenv<20.22.0; python_version < "3.8" (20.24.5)
ROOT: provision> .tox/.tox/bin/python -m tox
ROOT: will run in automatically provisioned tox, host /Users/jaraco/draft/.tox/.tox/bin/python is missing [requires (has)]: virtualenv<20.22.0; python_version < "3.8" (20.24.5)
ROOT: provision> .tox/.tox/bin/python -m tox
ROOT: will run in automatically provisioned tox, host /Users/jaraco/draft/.tox/.tox/bin/python is missing [requires (has)]: virtualenv<20.22.0; python_version < "3.8" (20.24.5)
^C

Minimal example

 draft @ cat tox.ini
[tox]
requires = 
        virtualenv < 20.22.0; python_version < "3.8"

It seems that the environment marker python_version < "3.8" is being used to filter the requirement for install but not for assessing the environment, so tox repeatedly thinks its requirements are unmet, installs them, and retries.

I suspect what needs to happen is that tox needs to honor the environment markers when assessing the environment.

@ssbarnea
Copy link
Member

ssbarnea commented Oct 10, 2023

I think that I may have hit this bug this morning, tox gets stuck for no clear reason:

$ tox -vvv -e lint
ROOT: 52 D setup logging to NOTSET on pid 54438 [tox/report.py:219]
ROOT: 82 W will run in automatically provisioned tox, host /Users/ssbarnea/.asdf/installs/python/3.12.0/bin/python3.12 is missing [requires (has)]: setuptools>=65.3.0 [tox/provision.py:121]
ROOT: 89 I find interpreter for spec PythonSpec(path=/Users/ssbarnea/.asdf/installs/python/3.12.0/bin/python3.12) [virtualenv/discovery/builtin.py:58]
ROOT: 89 I proposed PythonInfo(spec=CPython3.12.0.final.0-64, exe=/Users/ssbarnea/.asdf/installs/python/3.12.0/bin/python3.12, platform=darwin, version='3.12.0 (main, Oct  4 2023, 16:44:35) [Clang 15.0.0 (clang-1500.0.40.1)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:65]
ROOT: 89 D accepted PythonInfo(spec=CPython3.12.0.final.0-64, exe=/Users/ssbarnea/.asdf/installs/python/3.12.0/bin/python3.12, platform=darwin, version='3.12.0 (main, Oct  4 2023, 16:44:35) [Clang 15.0.0 (clang-1500.0.40.1)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:67]
ROOT: 90 D filesystem is not case-sensitive [virtualenv/info.py:26]
ROOT: 109 I will run in a automatically provisioned python environment under /Users/ssbarnea/c/a/ansible-lint/.tox/.tox/bin/python [tox/provision.py:142]
ROOT: 110 W provision> .tox/.tox/bin/python -m tox -vvv -e lint [tox/tox_env/api.py:427]
ROOT: 77 D setup logging to NOTSET on pid 54551 [tox/report.py:219]

Not sure what caused this regression, yesterday all was fine.

Also dis a thread dump, it seems that it gets stuck anyway, not only on provisioning.

$ tox -vvv -e lint --exit-and-dump-after 5
ROOT: 49 D setup logging to NOTSET on pid 55434 [tox/report.py:219]
Timeout (0:00:05)!
Thread 0x00000001dcfcd300 (most recent call first):
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/filelock/_api.py", line 232 in acquire
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/tox_env/package.py", line 42 in _func
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/package/pyproject.py", line 137 in register_config
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/tox_env/package.py", line 45 in _func
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/tox_env/api.py", line 70 in __init__
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/tox_env/package.py", line 57 in __init__
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/tox_env/python/api.py", line 64 in __init__
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/api.py", line 32 in __init__
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/tox_env/python/package.py", line 54 in __init__
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/tox_env/python/virtual_env/package/pyproject.py", line 101 in __init__
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/session/env_select.py", line 347 in _get_package_env
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/session/env_select.py", line 316 in _build_pkg_env
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/session/env_select.py", line 250 in _defined_envs
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/session/env_select.py", line 416 in ensure_only_run_env_is_active
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/session/cmd/run/common.py", line 236 in execute
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/session/cmd/run/sequential.py", line 24 in run_sequential
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/session/cmd/legacy.py", line 115 in legacy
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/run.py", line 45 in main
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/tox/run.py", line 19 in run
  File "/Users/ssbarnea/.asdf/installs/python/3.12.0/bin/tox", line 8 in <module>
FAIL: 1

@gaborbernat gaborbernat added the help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.
Projects
None yet
Development

No branches or pull requests

3 participants