-
-
Notifications
You must be signed in to change notification settings - Fork 323
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
hatch python install free threading version #1907
Comments
The variants aren't documented prominently enough, sorry about that https://hatch.pypa.io/latest/plugins/environment/virtual/#cpython |
Thanks @ofek, my bad that I have not checked the documentation deep enough! If I got it right, one has to export the HATCH_PYTHON_VARIANT_GIL environmental value in the shell before launching the creation of the environment. Is it possible to have a dedicated env defined in the pyproject.toml like this? [tool.hatch.envs.nogil]
features = ['dev']
python = '3.13'
HATCH_PYTHON_VARIANT_GIL = 'freethreaded' |
Yes that should work, please confirm? |
Not really... I have removed the python 3.13 because I had it already and it was the normal variant.
Then I try to create the nogil environment hoping it will install automatically the proper python version/variant.
and after a few seconds I got the message: Environment If I install the 3.13 version with:
I get the python normal variant installed. If I run again
I get the environment created but with the base variant.
I'm for sure doing something wrong. Is it possible to have two variants of the same python version installed at the same time? |
Hmm, that might be the issue: the variant is not included in the identification at the file system level so if you already have |
So, I have tried what you suggested, but with no luck. I have removed the installed 3.13, set the environment variable to select the freethreading variant and issued This is creating a folder 3.13 in the python dir, containing only a few subfolders compared to the other versions I have. The python executable is the freethreading one. Then I try to create the nogil env. But few seconds after later, an error message appears saying that the python3.13.dll was not found. On the shell, I get this message in red: There is surely something I am doing wrong and the worst thing is that I cannot have the two variants installed at the same time. My main goal is to have two envs, one with freethreading and one without, to compare the performance of my code. |
Can you use UV as a temporary measure? |
Thanks again for your help! Much appreciated! do you mean to switch (temporary) from hatch to uv, or just to configure hatch to use uv for environment creation? |
Here some more testing:
Problem with 3.13t installation If I set the environment variable HATCH_PYTHON_VARIANT_GIL = 'freethreaded' and then run This is the structure of the 3.12 python installation: While this is the directory structure of the 3.13t the content of the subfolder install is very similar to the one I was expecting. If I move the content of the install folder back one level, as shown here: then the creation of the nogil environment is successful, but apparently I cannot have two pythons 3.13 with and without free threading. It looks like that there is something wrong. hatch --version |
are there any news on this topic? thanks for your help! |
starting from python version 3.13 there are binary versions of python executable with GIL disabled. Is there a way to specify to the hatch python install command to install specifically this version?
If not, is there a plan to add this functionality in the future?
Thanks :)
The text was updated successfully, but these errors were encountered: