Skip to content

Error installing free threading python 3.13 (nogil) #3396

@javier-garcia-tilburg

Description

@javier-garcia-tilburg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions