Opencv-python compatibility with python versions 3.13+ (experimental/rc releases for multithreading)

I’m experimenting with Python 3.14.0rc1, which includes the free-threaded build (PEP 703) to improve multithreading performance by removing the GIL. My project relies heavily on the opencv-python package for image processing, but I’ve noticed there isn’t an official build supporting this Python version yet.

Is there a recommended way to get opencv-python working with Python 3.14? Should I look into building OpenCV from source for compatibility, or are there alternative approaches such as pre-release wheels or community builds?

Any guidance or best practices would be greatly appreciated.

Thanks!

Python’s free-threading has been an experimental offering in Python 3.13. this remains the case for 3.14, except it’s no longer called an experiment.

libraries are encouraged but not obligated to explore this experiment. that is because it’s a LOT of work to make a library compatible with this experiment. this is not related to building but to making sure that nothing crashes at runtime.

the original Python behavior is the default.

there is some minor activity related to this on OpenCV’s github(s):

feel free to read up on Python’s free threading mode and what’s required of libraries to support this. then you could explore how to adapt OpenCV to this. do not expect this to be an “easy fix”.

all that aside, OpenCV is already massively multithreaded and accelerated in all kinds of ways, even when used from Python.

Yes, I understand that not all packages are ready for the free-threaded Python builds and I’m also aware that OpenCV itself is already highly optimized and multithreaded internally. My focus, however, is not on further optimizing OpenCV, but on optimizing my overall workflow.

I have a set of algorithms that need to run in parallel, and many of them make use of OpenCV as part of their computation. While OpenCV handles its own operations efficiently, there are additional parts of the workflow outside of OpenCV that I’d like to benefit from true multithreading. For this reason, having OpenCV available as a dependency in a free-threaded Python environment is important.

I’ve gone through the GitHub issues and discussions you shared but haven’t found a concrete solution yet. Would building OpenCV manually from source against Python 3.14 free-threaded provide any chance of compatibility, or is the limitation primarily due to deeper runtime-level changes needed within OpenCV itself?

Thanks!