Skip to content

Error installing free threading python 3.13 (nogil) #3396

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

Closed
1 task
javier-garcia-tilburg opened this issue Feb 13, 2025 · 3 comments
Closed
1 task

Error installing free threading python 3.13 (nogil) #3396

javier-garcia-tilburg opened this issue Feb 13, 2025 · 3 comments
Labels
🐛 bug Something isn't working

Comments

@javier-garcia-tilburg
Copy link

Describe the bug

Trying to install python with PYTHON_GIL=0 throws an error

> pdm install -v
WARNING: Lockfile does not exist
Updating the lock file...
n.use_venv is on, creating a virtualenv for this project...
Run command: ['C:\\Users\\user\\AppData\\Roaming\\pdm\\venv\\Scripts\\python.exe', '-m', 'virtualenv', 'C:\\<project>\\.venv', '-p', 'C:\\Users\\user\\AppData\\Local\\pdm\\pdm\\python\\[email protected]\\python.exe', '--prompt=<project-name>-3.13', '--no-pip', '--no-setuptools','--no-wheel']
RuntimeError: failed to query C:\Users\user\AppData\Local\pdm\pdm\python\[email protected]\python.exe with code 1 err: 'Fatal Python error: config_read_gil: Disabling the GIL is not supported by this build\nPython runtime state: preinitialized\n\n'
[VirtualenvCreateError]: Command '['C:\\Users\\user\\AppData\\Roaming\\pdm\\venv\\Scripts\\python.exe', '-m', 'virtualenv', 'C:\\<project>
loss control strategies\\.venv', '-p', 'C:\\Users\\user\\AppData\\Local\\pdm\\pdm\\python\\[email protected]\\python.exe', '--prompt=<project-name>-3.13', 
'--no-pip',
'--no-setuptools', '--no-wheel']' returned non-zero exit status 1.

To reproduce

Create a project with the following pyproject.toml file

[project]
name = "project-name"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13"
classifiers = ["Private :: Do Not Upload"]
dependencies = [
    "numpy==2.1.3",
]

[tool.pdm]
distribution = false

Set the environment variable PYTHON_GIL=0 (e.g. write it to .env and reload shell). Then run pdm install -v

Expected Behavior

python 3.13 install correctly with nogil support

Environment Information

WARNING: Project requires a python version of >=3.13, The virtualenv is being created for you as it cannot be matched to the right version.
INFO: python.use_venv is on, creating a virtualenv for this project...
Virtualenv is created successfully at C:\<project>\.venv
{
  "implementation_name": "cpython",  
  "implementation_version": "3.12.8",
  "os_name": "nt",
  "platform_machine": "AMD64",       
  "platform_release": "10",
  "platform_system": "Windows",      
  "platform_version": "10.0.19045",
  "python_full_version": "3.13.1",
  "platform_python_implementation": "CPython",
  "python_version": "3.13",
  "sys_platform": "win32"
}

Verbose Command Output

No response

Additional Context

No response

Are you willing to submit a PR to fix this bug?

  • Yes, I would like to submit a PR.
@javier-garcia-tilburg javier-garcia-tilburg added the 🐛 bug Something isn't working label Feb 13, 2025
@frostming
Copy link
Collaborator

you did not install a free-threaded python

@javier-garcia-tilburg
Copy link
Author

javier-garcia-tilburg commented Feb 13, 2025

Yes, my current version 3.12 is not free-threaded. But it's not clear to my why this should be a problem. I also don't have a global install of python 3.9, but I still can use my current pdm to install 3.9 in the projects where it's needed. I would expect pdm to install a complete version of 3.13, including free-threading, in the projects that require 3.13 even if my global python interpreter is 3.12.

Or maybe I have missed the way to make it more explicit, specifying something like

requires-python = ">=3.13+freethreaded"

This seems to be how uv did it in Add support for requesting free-threaded builds via +freethreaded.

@frostming
Copy link
Collaborator

frostming commented Feb 14, 2025

No, you need to install free-threaded python yourself: pdm py install 3.13t && pdm use 3.13t

@frostming frostming closed this as not planned Won't fix, can't repro, duplicate, stale Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants