You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run actions/setup-python@v4
with:
python-version: [3](https://github.com/.../.../actions/runs/.../job/...#step:3:3).10
check-latest: false
token: ***
update-environment: true
allow-prereleases: false
Installed versions
Successfully set up CPython (3.10.13)
When I set
[testenv]
basepython = python3
in tox.ini, I get the following relevant tox -vvv output for any testenv I run (e.g. lint)
lint: 365 I find interpreter for spec PythonSpec(major=3) [virtualenv/discovery/builtin.py:58]
lint: 365 D discover exe for PythonInfo(spec=CPython3.10.13.final.0-64, exe=/home/runner/work/.../.../.tox/.tox/bin/python, platform=linux, version='3.10.13 (main, Aug 28 2023, 08:28:42) [GCC 11.4.0]', encoding_fs_io=utf-8-utf-8) in /opt/hostedtoolcache/Python/3.10.13/x64 [virtualenv/discovery/py_info.py:441]
lint: 366 D filesystem is case-sensitive [virtualenv/info.py:26]
lint: 367 D get interpreter info via cmd: /opt/hostedtoolcache/Python/3.10.13/x64/bin/python3.10 /home/runner/work/.../.../.tox/.tox/lib/python3.10/site-packages/virtualenv/discovery/py_info.py fbWnRIbnNk0Gs39468WVb6cbKruZkksw gwnyWfGaj815vR6d55dkIPVTk9KVYv7q [virtualenv/discovery/cached_py_info.py:111]
lint: 637 D wrote python info of %s at (PosixPath('/opt/hostedtoolcache/Python/3.10.13/x64/bin/python3.10'), PosixPath('/home/runner/.local/share/virtualenv/py_info/1/16ffcc7b051f840cfc860cf6e097c62dbc886225f5bf7c8ffd6a0f9b5902fc5b.json')) [virtualenv/app_data/via_disk_folder.py:151]
lint: 637 I proposed PythonInfo(spec=CPython3.10.13.final.0-64, system=/opt/hostedtoolcache/Python/3.10.13/x64/bin/python3.10, exe=/home/runner/work/.../.../.tox/.tox/bin/python, platform=linux, version='3.10.13 (main, Aug 28 2023, 08:28:42) [GCC 11.4.0]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:65]
lint: 638 D accepted PythonInfo(spec=CPython3.10.13.final.0-64, system=/opt/hostedtoolcache/Python/3.10.13/x64/bin/python3.10, exe=/home/runner/work/.../.../.tox/.tox/bin/python, platform=linux, version='3.10.13 (main, Aug 28 2023, 08:28:42) [GCC 11.4.0]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:67]
lint: 664 W skipped because could not find python interpreter with spec(s): python3 [tox/session/cmd/run/single.py:49]
If I specify
[testenv]
basepython = python3.10
I get
lint: 426 I find interpreter for spec PythonSpec(major=3, minor=10) [virtualenv/discovery/builtin.py:58]
lint: 426 D discover exe for PythonInfo(spec=CPython3.10.13.final.0-64, exe=/home/runner/work/.../.../.tox/.tox/bin/python, platform=linux, version='3.10.13 (main, Aug 28 2023, 08:28:42) [GCC 11.4.0]', encoding_fs_io=utf-8-utf-8) in /opt/hostedtoolcache/Python/3.10.13/x64 [virtualenv/discovery/py_info.py:441]
lint: 427 D filesystem is case-sensitive [virtualenv/info.py:26]
lint: 429 D get interpreter info via cmd: /opt/hostedtoolcache/Python/3.10.13/x64/bin/python3.10 /home/runner/work/.../.../.tox/.tox/lib/python3.10/site-packages/virtualenv/discovery/py_info.py nuSeDG9qS4srlMf6tK1DwPN85accotJq TxWUz0DsXkVu13R6WQrhh3jY5aSBkkat [virtualenv/discovery/cached_py_info.py:111]
lint: 758 D wrote python info of %s at (PosixPath('/opt/hostedtoolcache/Python/3.10.13/x64/bin/python3.10'), PosixPath('/home/runner/.local/share/virtualenv/py_info/1/16ffcc7b051f840cfc860cf6e097c62dbc886225f5bf7c8ffd6a0f9b5902fc5b.json')) [virtualenv/app_data/via_disk_folder.py:151]
lint: 759 I proposed PythonInfo(spec=CPython3.10.13.final.0-64, system=/opt/hostedtoolcache/Python/3.10.13/x64/bin/python3.10, exe=/home/runner/work/.../.../.tox/.tox/bin/python, platform=linux, version='3.10.13 (main, Aug 28 2023, 08:28:42) [GCC 11.4.0]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:65]
lint: 759 D accepted PythonInfo(spec=CPython3.10.13.final.0-64, system=/opt/hostedtoolcache/Python/3.10.13/x64/bin/python3.10, exe=/home/runner/work/.../.../.tox/.tox/bin/python, platform=linux, version='3.10.13 (main, Aug 28 2023, 08:28:42) [GCC 11.4.0]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:67]
lint: 790 W skipped because could not find python interpreter with spec(s): python3.10 [tox/session/cmd/run/single.py:49]
Finally, if I don't set basepython at all, I expect that tox will search for and find the interpreter tox is running within (in this case, an auto-provisioned interpreter in .tox/.tox), but I get:
lint: 352 I find interpreter for spec PythonSpec(path=/home/runner/work/.../.../.tox/.tox/bin/python) [virtualenv/discovery/builtin.py:58]
lint: 353 D discover exe for PythonInfo(spec=CPython3.10.13.final.0-64, exe=/home/runner/work/.../.../.tox/.tox/bin/python, platform=linux, version='3.10.13 (main, Aug 28 2023, 08:28:42) [GCC 11.4.0]', encoding_fs_io=utf-8-utf-8) in /opt/hostedtoolcache/Python/3.10.13/x64 [virtualenv/discovery/py_info.py:441]
lint: 353 D filesystem is case-sensitive [virtualenv/info.py:26]
lint: 354 D get interpreter info via cmd: /opt/hostedtoolcache/Python/3.10.13/x64/bin/python3.10 /home/runner/work/.../.../.tox/.tox/lib/python3.10/site-packages/virtualenv/discovery/py_info.py YMBB32pzIvG9KY2lZhCaFs7ilTz0aEr4 ptThd4tnbH1aQJUvjpZZebtzIpmkVjne [virtualenv/discovery/cached_py_info.py:111]
lint: 621 D wrote python info of %s at (PosixPath('/opt/hostedtoolcache/Python/3.10.13/x64/bin/python3.10'), PosixPath('/home/runner/.local/share/virtualenv/py_info/1/16ffcc7b051f840cfc860cf6e097c62dbc886225f5bf7c8ffd6a0f9b5902fc5b.json')) [virtualenv/app_data/via_disk_folder.py:151]
lint: 622 I proposed PythonInfo(spec=CPython3.10.13.final.0-64, system=/opt/hostedtoolcache/Python/3.10.13/x64/bin/python3.10, exe=/home/runner/work/.../.../.tox/.tox/bin/python, platform=linux, version='3.10.13 (main, Aug 28 2023, 08:28:42) [GCC 11.4.0]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:65]
lint: 622 D accepted PythonInfo(spec=CPython3.10.13.final.0-64, system=/opt/hostedtoolcache/Python/3.10.13/x64/bin/python3.10, exe=/home/runner/work/.../.../.tox/.tox/bin/python, platform=linux, version='3.10.13 (main, Aug 28 2023, 08:28:42) [GCC 11.4.0]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:67]
lint: 649 W skipped because could not find python interpreter with spec(s): /home/runner/work/.../.../.tox/.tox/bin/python [tox/session/cmd/run/single.py:49]
In all of these scenarios, it appears that tox
discovers the CPython3.10.13.final.0-64 interpreter I set up with actions/setup-python
proposes that interpreter
accepts that interpreter
skips the testenv because it can't find an interpreter that matches the spec
Naively, to me this seems like a bug: if the interpreter is discovered, proposed, and accepted (and no step in this process appears to have failed), then it feels like it should count as "found". It is also surprising to me that tox would not find the interpreter that tox itself is running from when basepython is not set. But I am sure I am just misunderstanding some detail about the process by which tox finds the interpreter.
I am happy to dive deeper into the debugging myself, but I wanted to ask for any rough guidance about how this process is supposed to work (for example, what step comes after "accepted" and is presumably failing? or what aspects are taken into account when trying to "match" a spec from basepython that might cause this interpreter to not be found?).
I am guessing that the interpreter is being "accepted" by virtualenv here
except (FileNotFoundError, RuntimeError): # Unable to find the interpreter
returnNone
And beyond that it gets a bit tricky for me to sort through at first glance once it runs into the session.
I can reproduce this locally on MacOS, where if I set basepython = python3.10 and run tox from a Homebrew Python 3.10.13 virtualenv with tox installed, I get
ROOT: 92 I find interpreter for spec PythonSpec(path=/Users/.../git/.../venv/bin/python) [virtualenv/discovery/builtin.py:58]
ROOT: 92 D discover exe for PythonInfo(spec=CPython3.10.13.final.0-64, exe=/Users/.../git/.../venv/bin/python, platform=darwin, version='3.10.13 (main, Aug 24 2023, 22:36:46) [Clang 14.0.3 (clang-1403.0.22.14.1)]', encoding_fs_io=utf-8-utf-8) in /opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10 [virtualenv/discovery/py_info.py:441]
ROOT: 93 D filesystem is not case-sensitive [virtualenv/info.py:26]
ROOT: 94 D got python info of %s from (PosixPath('/opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/bin/python3.10'), PosixPath('/Users/.../Library/Application Support/virtualenv/py_info/1/2d6cbd8ca062199a98662f3310ba6286764b31353ea4bf55baab4dae9f4129d0.json')) [virtualenv/app_data/via_disk_folder.py:131]
ROOT: 94 D got python info of %s from (PosixPath('/opt/homebrew/opt/python@3.10/bin/python3.10'), PosixPath('/Users/.../Library/Application Support/virtualenv/py_info/1/eda7e54fe21129b67f77862937907ee926f057597a3e2fa1e18ac955e40912b3.json')) [virtualenv/app_data/via_disk_folder.py:131]
ROOT: 94 I proposed PythonInfo(spec=CPython3.10.13.final.0-64, system=/opt/homebrew/opt/python@3.10/bin/python3.10, exe=/Users/.../git/.../venv/bin/python, platform=darwin, version='3.10.13 (main, Aug 24 2023, 22:36:46) [Clang 14.0.3 (clang-1403.0.22.14.1)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:65]
ROOT: 94 D accepted PythonInfo(spec=CPython3.10.13.final.0-64, system=/opt/homebrew/opt/python@3.10/bin/python3.10, exe=/Users/.../git/.../venv/bin/python, platform=darwin, version='3.10.13 (main, Aug 24 2023, 22:36:46) [Clang 14.0.3 (clang-1403.0.22.14.1)]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:67]
Traceback (most recent call last):
File "/Users/.../git/.../venv/bin/tox", line 8, in <module>
sys.exit(run())
File "/Users/.../git/.../venv/lib/python3.10/site-packages/tox/run.py", line 19, in run
result = main(sys.argv[1:] if args is None else args)
File "/Users/.../git/.../venv/lib/python3.10/site-packages/tox/run.py", line 41, in main
result = provision(state)
File "/Users/.../git/.../venv/lib/python3.10/site-packages/tox/provision.py", line 122, in provision
return run_provision(provision_tox_env, state)
File "/Users/.../git/.../venv/lib/python3.10/site-packages/tox/provision.py", line 141, in run_provision
env_python = tox_env.env_python()
File "/Users/.../git/.../venv/lib/python3.10/site-packages/tox/tox_env/python/virtual_env/api.py", line 155, in env_python
return cast(Path, self.creator.exe)
File "/Users/.../git/.../venv/lib/python3.10/site-packages/tox/tox_env/python/virtual_env/api.py", line 126, in creator
return self.session.creator
File "/Users/.../git/.../venv/lib/python3.10/site-packages/tox/tox_env/python/virtual_env/api.py", line 107, in session
self._virtualenv_session = session_via_cli(env_dir, options=None, setup_logging=False, env=env)
File "/Users/.../git/.../venv/lib/python3.10/site-packages/virtualenv/run/__init__.py", line 49, in session_via_cli
parser, elements = build_parser(args, options, setup_logging, env)
File "/Users/.../git/.../venv/lib/python3.10/site-packages/virtualenv/run/__init__.py", line 88, in build_parser
element.handle_selected_arg_parse(options)
File "/Users/.../git/.../venv/lib/python3.10/site-packages/virtualenv/run/plugin/seeders.py", line 32, in handle_selected_arg_parse
return super().handle_selected_arg_parse(options)
File "/Users/.../git/.../venv/lib/python3.10/site-packages/virtualenv/run/plugin/base.py", line 55, in handle_selected_arg_parse
raise RuntimeError(msg)
RuntimeError: No implementation for PythonInfo(spec=CPython3.10.13.final.0-64, system=/opt/homebrew/opt/python@3.10/bin/python3.10, exe=/Users/.../git/.../venv/bin/python, platform=darwin, version='3.10.13 (main, Aug 24 2023, 22:36:46) [Clang 14.0.3 (clang-1403.0.22.14.1)]', encoding_fs_io=utf-8-utf-8)
Environment
In short, I am using tox==4.11.4 and virtualenv==20.25.0 which are both latest at the time of writing.
In GHA, I am using Python 3.10.13 provisioned via actions/setup-python@v4.
On local machine (MacOS), I am using Homebrew Python 3.10.13.
Hello! I am a huge fan of tox and greatly appreciative of the work it takes to develop and maintain it - thank you!
Issue
Recently I have been encountering
skipped because could not find python interpreter with spec
issues while trying to run tox in github actions.tox-requires
, so my tox run is running in an auto-provisioned.tox/.tox
env.skip_missing_interpreters
in mytox.ini
.In all cases, I set up python3.10 in my GHA YAML:
and this step succeeds with output
When I set
in
tox.ini
, I get the following relevanttox -vvv
output for any testenv I run (e.g.lint
)If I specify
I get
Finally, if I don't set
basepython
at all, I expect that tox will search for and find the interpreter tox is running within (in this case, an auto-provisioned interpreter in.tox/.tox
), but I get:In all of these scenarios, it appears that tox
CPython3.10.13.final.0-64
interpreter I set up withactions/setup-python
Naively, to me this seems like a bug: if the interpreter is discovered, proposed, and accepted (and no step in this process appears to have failed), then it feels like it should count as "found". It is also surprising to me that tox would not find the interpreter that tox itself is running from when
basepython
is not set. But I am sure I am just misunderstanding some detail about the process by which tox finds the interpreter.I am happy to dive deeper into the debugging myself, but I wanted to ask for any rough guidance about how this process is supposed to work (for example, what step comes after "accepted" and is presumably failing? or what aspects are taken into account when trying to "match" a spec from
basepython
that might cause this interpreter to not be found?).I am guessing that the interpreter is being "accepted" by virtualenv here
https://github.com/pypa/virtualenv/blob/5ad4de304a8e0344d0c3084c31f129119e50a377/src/virtualenv/discovery/builtin.py#L67
But it is not being found because this returns None:
tox/src/tox/tox_env/python/api.py
Line 251 in 383845a
And this is maybe happening because of a FileNotFoundError or RuntimeError here:
tox/src/tox/tox_env/python/virtual_env/api.py
Lines 133 to 136 in 383845a
And beyond that it gets a bit tricky for me to sort through at first glance once it runs into the session.
I can reproduce this locally on MacOS, where if I set
basepython = python3.10
and run tox from a Homebrew Python 3.10.13 virtualenv with tox installed, I getEnvironment
In short, I am using
tox==4.11.4
andvirtualenv==20.25.0
which are both latest at the time of writing.In GHA, I am using Python 3.10.13 provisioned via
actions/setup-python@v4
.On local machine (MacOS), I am using Homebrew Python 3.10.13.
Output of
pip list
of the host Python, wheretox
is installedMinimal example
Unfortunately, I have not been able to identify a minimal example.
The text was updated successfully, but these errors were encountered: