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

20.29.1 can't install wheels on free-threaded Python #2829

Open
nedbat opened this issue Jan 19, 2025 · 8 comments
Open

20.29.1 can't install wheels on free-threaded Python #2829

nedbat opened this issue Jan 19, 2025 · 8 comments
Labels

Comments

@nedbat
Copy link

nedbat commented Jan 19, 2025

Coverage.py runs tests against the Python nightly builds. They succeed with virtualenv==20.28.1, but fail to install on free-threaded Python with virtualenv==20.29.1.

Nightly tests with 20.28.1 using commit f3f4730 succeeds.

Nightly tests with 20.29.1 using commit 0f5efe8 fails with:

  py313: install_package> python -m pip install -U --force-reinstall --no-deps .tox/.tmp/package/1/coverage-7.6.11a0.dev1-0.editable-cp313-cp313t-linux_x86_64.whl
  ERROR: coverage-7.6.11a0.dev1-0.editable-cp313-cp313t-linux_x86_64.whl is not a supported wheel on this platform.

The difference between the two commits is only the version of virtualenv: nedbat/coveragepy@f3f4730...0f5efe8

I tried updating only the version of setuptools, and it succeeded.

@nedbat nedbat added the bug label Jan 19, 2025
@gaborbernat
Copy link
Contributor

Cc @robsdedude

@robsdedude
Copy link
Contributor

I'm making a guess here: could it be that you specify the Python version (something like the 3 in virtualenv -p python3)?

If so, there are two ways to solving this issue (apart from changing how virtualenv works, of course): either don't specify the version (e.g. virtualenv -p python) or explicitly select free-threaded Python (e.g. -p python3t).

As it stands right now, virtualenv will take any version, including free-threaded ones, when not specifying a version. If, however, a version is specified, virtualenv will respect the selection of free-threading or lack thereof.

@nedbat
Copy link
Author

nedbat commented Jan 19, 2025

I'm using a GitHub Action matrix, which runs tox, which uses tox-gh. I can try being either less or more explicit about the version, but there are layers here that I'm not expert in. If you have suggestions, I'm open.

@nedbat
Copy link
Author

nedbat commented Jan 19, 2025

The virtualenv is created by tox I think. I'm not sure what specifies the Python to use.

@nedbat
Copy link
Author

nedbat commented Jan 19, 2025

I tried updating my tox.ini to have py313t and py314t:

--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,7 @@
 [tox]
 # When changing this list, be sure to check the [gh] list below.
 # PYVERSIONS
-envlist = py3{9,10,11,12,13,14}, pypy3, doc, lint, mypy
+envlist = py3{9,10,11,12,13,14}, py3{13,14}t, pypy3, doc, lint, mypy
 skip_missing_interpreters = {env:COVERAGE_SKIP_MISSING_INTERPRETERS:True}
 toxworkdir = {env:TOXWORKDIR:.tox}

@@ -54,6 +54,12 @@ commands =
     # Test with the PyTracer
     python igor.py test_with_core pytrace {posargs}

+[testenv:py313t]
+basepython = python3.13t
+
+[testenv:py314t]
+basepython = python3.14t
+
 [testenv:anypy]
 # $set_env.py: COVERAGE_ANYPY - The custom Python for "tox -e anypy"
 # For running against my own builds of CPython, or any other specific Python.

That results in:

% tox -e py313t
py313t: pip-24.3.1-py3-none-any.whl already present in /Users/ned/Library/Application Support/virtualenv/wheel/3.13/embed/3/pip.json
py313t: install_deps> python -m pip install -U -r requirements/pip.pip -r requirements/pytest.pip
.pkg-cpython313: install_requires> python -I -m pip install setuptools
.pkg-cpython313: _optional_hooks> python /usr/local/virtualenvs/coverage/lib/python3.9/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg-cpython313: get_requires_for_build_editable> python /usr/local/virtualenvs/coverage/lib/python3.9/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg-cpython313: build_editable> python /usr/local/virtualenvs/coverage/lib/python3.9/site-packages/pyproject_api/_backend.py True setuptools.build_meta
py313t: install_package_deps> python -m pip install -U 'tomli; python_full_version <= "3.11.0a6"'
py313t: install_package> python -m pip install -U --force-reinstall --no-deps .tox/.tmp/package/1/coverage-7.6.11a0.dev1-0.editable-cp313-cp313-macosx_15_0_arm64.whl
ERROR: coverage-7.6.11a0.dev1-0.editable-cp313-cp313-macosx_15_0_arm64.whl is not a supported wheel on this platform.

py313t: exit 1 (0.23 seconds) /Users/ned/coverage/trunk> python -m pip install -U --force-reinstall --no-deps .tox/.tmp/package/1/coverage-7.6.11a0.dev1-0.editable-cp313-cp313-macosx_15_0_arm64.whl pid=51840
  py313t: FAIL code 1 (6.69 seconds)
  evaluation failed :( (6.97 seconds)

For some reason the wheel is cp313 instead of cp313t.

I feel like among virtualenv, tox, and tox-gh, I'm in a maze of twisty little repos that interact in ways I don't understand. tox-dev/tox#3391 seems relevant too.

@robsdedude
Copy link
Contributor

robsdedude commented Jan 20, 2025

I didn't dig into it, so this is speculation on my part. AFAIK, tox does not recognize free-threaded Python environments. And I don't think that setting basepython to python3.13t works either. Setting it to a path might work, but I understand that that is cumbersome. So either we need to change the design of virtualenv, or make tox understand free-threaded Python specs. WDYT @gaborbernat

I designed virtualenv's understanding of free-threading in a way that users can explicitly choose a non-free-threaded build. I think that should remain an option, but maybe in a different way.

@robsdedude
Copy link
Contributor

@nedbat I just had an idea. Could you try as a workaround to change your tox ini like above except with

[testenv:py313t]
basepython = python

[testenv:py314t]
basepython = python

while making sure that in CI only the free threaded versions are installed?

@nedbat
Copy link
Author

nedbat commented Jan 20, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants