Repository navigation
Python 3.11 #8304
Description
This is the meta/coordination issue for Python 3.11 support for Numba and llvmlite.
Note: The issue text will be updated continuously to reflect the current process and progress.
As Numba interfaces with cpython on the bytecode and C-level, Python minor version upgrades present a significant compatibility challenge and have -- in the past -- required multiple PRs over multiple months of work. For Python 3.11 this issue will serve as a central point of coordination of the efforts. As such it will list the current branches pertaining to Python 3.11 support in addition to using the tag Python 3.11.
In order to support testing against beta releases and release candidates, I created a small utility that allows easy setup of a Numba development environment against a Python pre-release docker container. https://github.com/numba/numba-hatchery this can be used with development branches/repositories of Numba and llvmlite.
-
llvmlite status
- Using the PR bump max Python version to 3.11 llvmlite#869 passes all unit tests when used with numba-hatchery
-
numba status
- Numba Python 3.11 support is now being worked on across multiple branches:
- https://github.com/esc/numba/tree/python3.11_partial/version_bump -- version bump
- https://github.com/esc/numba/tree/python3.11_partial/compile-hack -- compile hacks (WIP)
- https://github.com/esc/numba/tree/python3.11_partial/implement_resume -- RESUME implementation
- Numba would not compile initially. The https://github.com/esc/numba/tree/python3.11_partial/compile-hack branch was created to allow. Numba to compile
- The new
RESUMEopcode wasn't being handled. https://github.com/esc/numba/tree/python3.11_partial/implement_resume implements this. - The branch
esc/python3.11now contains a merge of all involved feature branches and can be used for testing all required patches in unison: Python3.11 #8381 - @sklam is making progress with the bytecode at: https://github.com/sklam/numba/tree/py3.11wip
- Numba Python 3.11 support is now being worked on across multiple branches:
-
TODO
- Cleanup the compile-hacks PR so that it is sane and not just something to allow compilation
- Port distutils to use setuptools as per https://peps.python.org/pep-0632/
Activity
Prepare Python 3.11 support (#31170)
jschwar313 commentedon Jan 11, 2023
Is there a pip command available to install a dev version of numba on python 3.11.1?
jamesmyatt commentedon Jan 11, 2023
Look at https://pip.pypa.io/en/stable/topics/vcs-support/ and Example #5 here https://pip.pypa.io/en/stable/cli/pip_install/#examples
jschwar313 commentedon Jan 11, 2023
Yea, that part I know. What's the github location of the software I would install that would replace the numba package? That I don't know. Thanks.
build(deps): bump to python 3.10 + package upgrades
sklam commentedon Jan 12, 2023
If you want to pip install via the vcs support, you can do so via
pip install git+https://github.com/numba/numba@py3.11. But bewared that installing llvmlite is not as easy due to llvm. That is why we provided a docker setup for testing. The easiest way to get the llvm is still by using ourllvmdevconda package.Prepare Python 3.11 support (#31170)
MarcusTherkildsen commentedon Jan 24, 2023
6 months and still no sign of a release. What's the hold up?
esc commentedon Jan 25, 2023
Thank you for asking about this. To clarify, the hold-up comes from two sources:
Waiting on anaconda-official Python 3.11 conda packages, inkl. dependencies (Numpy, etc..) -- Python 3.11 is available at the time of writing, but the dependencies are missing. Our build and release pipelines depend on anaconda-conda packages for the time being and while there are conda-forge packages, there are too unstable for our needs and have caused more issues than solved ones in the past. Upgrading the pipeline for some other build system is not an option due to resource constraints.
The need to update the Numba code-base to support Python 3.11. Numba operates on Python bytecode and this is essentially a moving target. It takes between 3-6 months of work for every minor Python release to make Numba compatible with the new bytecode version. Bytecode isn't designed as an interface, so both the number of bytecodes and how each one behaves changes significantly with every Python minor Version. For Python 3.11 we are almost there and there are only a handful of tests still failing, last time I checked.
In the name of the Numba developers I would like to re-iterate that we are grateful for your continued patience on this front. It's not long to go now and based on today's evidence I expect a Numba release candidate that supports Python 3.11 to become available in 3-6 weeks. 🙏
MarcusTherkildsen commentedon Jan 25, 2023
That sounds great, thanks for the update!
esc commentedon Feb 20, 2023
Just a quick update here. We are still working on this. The Python 3.11 support is now complete and we are waiting on certain Numba dependencies to be packaged as conda packages via anaconda.org (can be tracked at: ContinuumIO/anaconda-issues#13082). Most things for the next release are in place and things are moving forward. Thank you again everyone for your sustained patience!!
thebaptiste commentedon Feb 20, 2023
May be you should consider using something else than conda for your CI ?
Your code seems to be ready, your dependencies are also ready (tarballs or wheels), but you have to wait for conda packages, what a waste of time !
May be you could considerer providing a tarball pre-release ?
tanlin2013 commentedon Feb 20, 2023
Perhaps we could also release on pip first. That will be appreciated too!
seibert commentedon Feb 20, 2023
Just to clarify: This is definitely something we want to improve, but the challenge here is in testing and validating that Numba works in every way it needs to in every environment we support. Putting Numba into a package file (conda or wheel or whatever) is relatively more straightforward, but that doesn't ensure it will work.
We have relied on conda mostly because it enabled us to easily create 100+ different environment configurations across different combinations of CPU platform (x86, arm, ppc), operating system (win, mac, linux), numpy (several here), as well as to check parallel execution with various threading backends (OpenMP, TBB, etc), along with different CUDA versions. One we are sure all that is OK, then making a final wheel/sdist is not much trouble.
So the take away is that we definitely hear the feedback, but are seeking a way to ensure we can efficiently test Numba so that when a new release is posted, it will work for everyone. We have some ideas and will try some process changes this year.
MarcusTherkildsen commentedon Mar 6, 2023
Hi again
25th of January you said:
"It's not long to go now and based on today's evidence I expect a Numba release candidate that supports Python 3.11 to become available in 3-6 weeks. 🙏"
We are closing in on 6 weeks now (in two days). What is the status?
Thanks for your hard work, it makes our work a lot easier :)
esc commentedon Mar 6, 2023
@MarcusTherkildsen thank you for asking about this. I asked around today and here is what I gather:
So the TL;DR: progress has been made and chances are good to get a release candidate next week or the week after, barring any more major issues arising during integration of the dev branches.
Also, It looks like @sklam will be the release manager for this one -- so please feel free to add more context in case I forgot something!
adding 3.11 actually was what broke actions lol
set up `black` pre-commit hook
SimonBiggs commentedon Mar 8, 2023
An amazing approach to this is to deploy dev releases on PyPI. Get us (the community) to make sure things work for you 🙂
If there was currently a dev release on PyPI for llvm and numba, I'd certainly be keen to be testing that out for you.
Also, I tried the following to craft my own dev release, but had no success. See my attempt below.
git clone https://github.com/numba/numba.git git checkout py3.11 pip install -e .And I got the following:
I then tried:
And I got the following:
I then ran the following:
And got:
I then had a look at the guides around that (https://llvmlite.readthedocs.io/en/latest/admin-guide/install.html#compiling-llvm)... and after ~30 mins gave up 🙁
Take 2
Following the guide in the docs:
http://llvmlite.pydata.org/en/latest/admin-guide/install.html#compiling-llvm
Installation
I'll report back once it's built...
SimonBiggs commentedon Mar 9, 2023
Unfortunately the build errored like so: 🙁
But nevertheless, when I run the following the pip install works:
Here's a zip file of the compiled bin directory if others want to use it:
[Redacted (see request below)]
And installing numba works:
But unfortunately importing numba after installation doesn't work:
jakirkham commentedon Mar 9, 2023
It might be easier to start from something like the conda-forge recipes when building locally. There's even a PR for
llvmliteto add Python 3.11 ( conda-forge/llvmlite-feedstock#66 ). Though it will require more recent source code forllvmlite, which is easy enough to addsirfz commentedon Mar 9, 2023
Regarding the patches, indeed
llvm-lto-static.patchandllvm_11_consecutive_registers.patchare broken. I have "fixed" local copies that work:llvm-lto-static.patch:
as for
llvm_11_consecutive_registers.patch, just removellvm/from the beginning of all file paths and it'll succeed. (e.g.a/include/llvm/CodeGen/TargetLowering.hinstead ofa/llvm/include/llvm/CodeGen/TargetLowering.h)esc commentedon Mar 10, 2023
@SimonBiggs @sirfz @jakirkham thank you for adding to this issue! Yes, it is true that Numba/llvmlite are tricky to build(!), since this thread is about Python 3.11 support, if you are still (interested in)/(trying to) create a dev release I would encourage you to open a new issue titled "difficulties creating dev build", so that we can keep the signal-to noise ratio low for all parties subscribed to this issue. We will be happy to assist and help debug, but please the read the following comments below first.
llvm-lto-static.patchand for thellvm_11_consecutive_registers.patchit needs to be applied using-p2not-p1(conda-build is smart enough to auto-detect the patch level, so this went unnoticed). These are bugs in the llvmlite documentation, but since we are now moving to LLVM14 they will need to be upgraded to---whatever that LLVM version needs---as part of llvmlitev0.40.0anyway.Thank you again all for adding to this issue and thank you again everyone subscribed for your continued patience, we hope to have some Numba and llvmlite release candidates soon! 🙏 🙏 🙏
Scolymus commentedon Mar 10, 2023
hey @esc ,
so I understand this version won't be compatible with numpy>1.24, right? I know it may not be the place to ask but, can I know what's the problem with numpy >1.24 and when there will be a version for that? I never use numba, but just install a repo dependent on numba, and after having my project working in local and integrating in a bigger project I realized numba wasn't working with numpy 1.25, which is what we use in the other project... I installed 0.57.0dev0 to allow pip to install numba while having numpy > 1.24, but I got an error that I saw is related with numpy version in a different issue:
initialization of _internal failed without raising an exceptionesc commentedon Mar 10, 2023
@Scolymus -- from what I can tell support for 1.24 was merged here: #8691 --
esc commentedon Mar 10, 2023
@Scolymus and 1.25 support is no implemented yet and being tracked here: #8698
imichaelmoore commentedon Mar 14, 2023
This issue is quite convoluted at this point, could one of the maintainers chime in and let the community know specifically what they need help with in terms of testing? We are all watching this issue but at this point it's not clear what needs to be tested to enable a release. (And we want to help! 😄 )
esc commentedon Mar 14, 2023
Sure, allow me to chime in! @sklam is currently still merging development branches and we are hoping to publish a release candidate next week (maybe the week after...). As soon the projects have been tagged and the build artifacts produced, we will be very grateful for everyone to test those candidates with their respective libraries and applications (and of course... to report back any encountered issues). An announcement with instructions on how to install will be posted to our discourse (numba.discourse.group) and will post a link here too, pointing everyone in the right direction.
kaluzniacki commentedon Mar 17, 2023
The developers have my sympathies - I very much understand how using conda makes things easier - I hope to never have to install gdal without conda, and I can install independent versions of gcc with conda. Best of luck!
sklam commentedon Mar 21, 2023
Py3.11 branch have been merged to main by #8822
sklam commentedon Mar 22, 2023
We are planning to cut an RC next week. Closing
jakirkham commentedon Mar 22, 2023
Is there an issue to track updates on the RC and releases?
stuartarchibald commentedon Mar 23, 2023
A Release Candidate checklist for 0.57.0rc1 is now in #8841. Please do subscribe to that if you are interested in following progress. The official RC announcement will be made on the discourse forum as usual.
🐍 Update Supported Python Versions (add 3.11 ) (#500)
quanqigu commentedon Mar 18, 2025
Python3.11 is supported from numba 0.57.0.
hauntsaninja commentedon Mar 18, 2025
https://github.com/hauntsaninja/python_readiness