uv
uv copied to clipboard
`uv` should exclude `abi3` wheels in free-threaded Python 3.13+
Starting with the version 3.13 alpha releases, CPython can optionally be configured to run without the global interpreter lock. This build configuration ("free-threaded") is not compatible with abi3 wheels.
Additionally, the version specific wheels require the "t" suffix in the ABI tag. For example, cp313-cp313t-manylinux_2_35_x86_64 (free-threaded build) instead of cp313-cp313-manylinux_2_35_x86_64 (default 3.13 build).
Steps to reproduce issue
- Build python from source with
--disable-gil uv venv,source .venv/bin/activateuv pip install psutilpython -c "import psutil"Segmentation fault (core dumped)
Identifying --disable-gil CPython builds
I think the best way is to check if sysconfig.get_config_var("Py_GIL_DISABLED") returns True.
packaging.tags instead checks for a "t" in sys.abiflags, but this is because of constraints on the public API exposed by the package. I think using sysconfig is likely a better option for uv.
See also:
- https://github.com/pypa/packaging/blob/e0dda88874e73cd484b9e8464c5921a903db3cf0/src/packaging/tags.py#L229-L230
Awesome, thank you.
@konstin - Interested in this one?
@colesbury What is the canonical name for this feature, "no-gil python", "gil disabled" or "free-threaded python"?
As a more technical question, is psutil expected to still error when built from source with python 3.13.0a5? (I can built from main too if that's better)
uv
$ uv venv -q -p python3.13 .venv3.13 --no-cache-dir && uv pip install psutil --no-cache-dir && .venv3.13/bin/python -c "import psutil"
Resolved 1 package in 206ms
Downloaded 1 package in 90ms
Installed 1 package in 1ms
+ psutil==5.9.8
Segmentation fault (core dumped)
pip
$ cargo run -q -- venv -q -p python3.13 .venv3.13 --no-cache-dir && cargo run -q -- pip install psutil --no-cache-dir && .venv3.13/bin/python -c "import psutil"
Resolved 1 package in 225ms
Built psutil==5.9.8 Downloaded 1 package in 1.51s
Installed 1 package in 0.78ms
+ psutil==5.9.8
Traceback (most recent call last):
File "<string>", line 1, in <module>
import psutil
File "/home/konsti/projects/uv/.venv3.13/lib/python3.13/site-packages/psutil/__init__.py", line 102, in <module>
from . import _pslinux as _psplatform
File "/home/konsti/projects/uv/.venv3.13/lib/python3.13/site-packages/psutil/_pslinux.py", line 25, in <module>
from . import _psutil_linux as cext
ImportError: /home/konsti/projects/uv/.venv3.13/lib/python3.13/site-packages/psutil/_psutil_linux.abi3.so: undefined symbol: _Py_atomic_add_ssize
If yes, here's a PR implementing the t abiflag: https://github.com/astral-sh/uv/pull/2805
@colesbury What is the canonical name for this feature, "no-gil python", "gil disabled" or "free-threaded python"?
Not Sam, but as per the Steering Council decision, the canonical name is "free-threaded Python": https://github.com/python/steering-council/issues/221#issuecomment-1841593283.
As a more technical question, is psutil expected to still error when built from source with python 3.13.0a5...
Oof... yeah I think that's something we need to fix either in CPython or in psutil