Reputation: 51
I am excited to experiment with python3.13 with new GIL optional feature. I want to explore the impact of disabling GIL to achieve real multi-threading in python. I want a real world example to compare the python3.13 performance for multi-threading with GIL enabled and disabled.
In the same environment, can i run two python one with GIL and other without GIL?
REF: PEP703
Upvotes: 3
Views: 2526
Reputation: 1620
Fedora users can run the following, as explained here.
sudo dnf install python3.13-freethreading
This will install the interpreter at /usr/bin/python3.13t
.
Upvotes: 1
Reputation: 384
Ubunt users can use:
sudo add-apt-repository ppa:deadsnakes
sudo apt-get update
sudo apt-get install python3.13-nogil
Upvotes: 1
Reputation: 349
According to the What's new in Python 3.13, you need a new Python binary to test it.
The free-threaded mode requires a different executable, usually called python3.13t or python3.13t.exe.
Using pyenv
latest version to install Python, this should give you a virtual environment to test it (in most unix systems):
pyenv install 3.13t-dev
$HOME/.pyenv/versions/3.13t-dev/bin/python3.13t -m venv .venv
source .venv/bin/activate
You can check it with sys._is_gil_enabled()
python -c 'import sys; print(sys._is_gil_enabled())'
# you should get 'False'
Upvotes: 4