-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
ENH: Python 3.13 free-threading support #59057
Comments
Hi! I'm currently writing a thesis on free-threading python and wonder if there's any estimate on how much time this would take |
Hello! An initial investigation shows that it should be relatively straight-forward to get a passing test suite under the free-threaded build. However, if you're looking for a full release with support for it, it's still probably going to be a few weeks/months, since Python 3.13 is not final (not even in rc) yet. Maybe a maintainer could answer this better than me as well. |
Yeah I'm only in need of a "preliminary" implementation to run some really simple tests involving a dataframe with python 3.13.0b2 with the free threading build. Right now it's not even installing correctly. |
@xbit18 you probably have managed to do it since your last comment but the https://py-free-threading.github.io doc has a lot of useful info in particular:
|
I'm trying to get Windows wheels to build successfully as well. It seems like it's an easy task to build them, but not as easy to test them, because Windows wheels are tested on @mroeschke You implemented this in #53087. Is there any way around it? There's this comment in the workflow file. Could you elaborate on it?
The Docker images do not contain a free-threaded build, so it's currently impossible to do this for the free-threaded wheels. Should we enable |
Maybe it's not entirely necessary to test these wheels on a separate Docker image anymore and just use the windows images from the GHA runner if that makes this easier |
FWIW @lesteve just let me know over in a scikit-learn issue that scikit-learn is going to need the docker images as well. |
hi, How long until Python 3.13's free-threading support is complete? |
I tried pandas with GIL off with TQDM wrapper, I was getting seg faults with the tqdm thread. Let me know if you need the code to replicate this issue. Fatal Python error: Segmentation fault Thread 0x00007f642dffd640 (most recent call first): Thread 0x00007f642effe640 (most recent call first): |
yes please |
`
` This is the gist of what I was trying to do.
`
`
|
@colesbury could this be a CPython bug? I can reproduce the crash, here's the traceback:
I think we're hitting the pandas/pandas/_libs/hashtable_class_helper.pxi.in Line 1363 in 73da90c
This is in a cython Extra bit of weirdness: if I remove the use of tqdm from the script, the crash doesn't happen. |
That's not true, I can trigger crashes without the context manager. And I initially thought that the workers weren't operating on shared data, but that's not true, there's definitely some mutating of shared arrays happening. In which case, @HackStrix you might be hitting the fact that ndarray itself is not thread safe, even in the GIL-enabled build: https://numpy.org/doc/stable/reference/thread_safety.html#thread-safety |
Maybe.... should I build Pandas from source to repro this? Might be helpful to look at the Cython generated code. |
I can repro it using the wheel but building pandas from source with debug symbols will likely help:
That'll leave the build directory afterward in |
I saw a crash that involved
The mutation looks like it's on a deep copy, not shared data, but I don't know pandas well enough to be sure: |
Ah you're right, so no mutation but the
I don't see any kind of locking in the definition in |
My understanding was creating a deep copy should have avoided mutation of original ndarray. Just wondering if it is possible, due to optimisation, the deep copy only copies on write? |
This aims to be a tracking issue for all work necessary to support the free-threaded build of Python 3.13. A very high-level list of steps is (more details to follow as I investigate more issues):
pandas_datetime
is thread-safepandas_parser
is not thread-safe, but cannot be used in multiple threads from withinpandas
Python code.Py_mod_gil
slotThe text was updated successfully, but these errors were encountered: