diff --git a/scripts/__init__.py b/scripts/__init__.py index 587a42bf..c7086c07 100644 --- a/scripts/__init__.py +++ b/scripts/__init__.py @@ -1,3 +1,22 @@ +""" +OpenCV Python bindings + +This module provides Python bindings for OpenCV. + +Important notes for multiprocessing: +- OpenCV is not fork-safe. Using cv2 functions after fork() can cause + "corrupted double-linked list" errors and memory corruption. +- If you use multiprocessing with fork (the default on Linux/macOS), + either: + 1. Use spawn mode: multiprocessing.set_start_method('spawn') + 2. Call cv2.setNumThreads(0) in each worker before using cv2 +- See: https://github.com/opencv/opencv-python/issues/1166 +""" + +import os +import sys +import warnings + PYTHON_EXTENSIONS_PATHS = [ LOADER_DIR ] + PYTHON_EXTENSIONS_PATHS @@ -21,4 +40,4 @@ if sys.platform.startswith("linux") and ci_and_not_headless: os.environ["QT_QPA_FONTDIR"] = os.path.join( os.path.dirname(os.path.abspath(__file__)), "qt", "fonts" - ) + ) \ No newline at end of file diff --git a/setup.py b/setup.py index d0c57b48..952f37ce 100755 --- a/setup.py +++ b/setup.py @@ -24,7 +24,9 @@ def main(): install_requires = [ 'numpy<2.0; python_version<"3.9"', - 'numpy>=2; python_version>="3.9"', + 'numpy>=2.0.2; python_version>="3.9" and python_version<"3.13"', + 'numpy>=2.1.3; python_version>="3.13" and python_version<"3.14"', + 'numpy>=2.3.0; python_version>="3.14"', ] python_version = cmaker.CMaker.get_python_version()