we need wheels for python 3.14, it's falling back to numpy which requires all the tools to compile from source
opencv doesnt work with python 3.14 opencv wheels for python 3.14 opencv update needed opencv numpy
Using cached opencv_python-4.12.0.88-cp37-abi3-win_amd64.whl.metadata (19 kB) Collecting numpy<2.3.0,>=2 (from opencv-python) Using cached numpy-2.2.6.tar.gz (20.3 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [21 lines of output] + C:\Users\Arthur\AppData\Local\Programs\Python\Python314\python.exe C:\Users\Arthur\AppData\Local\Temp\pip-install-lo_d4nz9\numpy_5d32a18868064226ad139d5718fc80e4\vendored-meson\meson\meson.py setup C:\Users\Arthur\AppData\Local\Temp\pip-install-lo_d4nz9\numpy_5d32a18868064226ad139d5718fc80e4 C:\Users\Arthur\AppData\Local\Temp\pip-install-lo_d4nz9\numpy_5d32a18868064226ad139d5718fc80e4.mesonpy-u1w001bs -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=C:\Users\Arthur\AppData\Local\Temp\pip-install-lo_d4nz9\numpy_5d32a18868064226ad139d5718fc80e4.mesonpy-u1w001bs\meson-python-native-file.ini The Meson build system Version: 1.5.2 Source dir: C:\Users\Arthur\AppData\Local\Temp\pip-install-lo_d4nz9\numpy_5d32a18868064226ad139d5718fc80e4 Build dir: C:\Users\Arthur\AppData\Local\Temp\pip-install-lo_d4nz9\numpy_5d32a18868064226ad139d5718fc80e4.mesonpy-u1w001bs Build type: native build Project name: NumPy Project version: 2.2.6 WARNING: Failed to activate VS environment: Could not find C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe
..\meson.build:1:0: ERROR: Unknown compiler(s): [['icl'], ['cl'], ['cc'], ['gcc'], ['clang'], ['clang-cl'], ['pgcc']]
The following exception(s) were encountered:
Running `icl ""` gave "[WinError 2] O sistema não pode encontrar o arquivo especificado"
Running `cl /?` gave "[WinError 2] O sistema não pode encontrar o arquivo especificado"
Running `cc --version` gave "[WinError 2] O sistema não pode encontrar o arquivo especificado"
Running `gcc --version` gave "[WinError 2] O sistema não pode encontrar o arquivo especificado"
Running `clang --version` gave "[WinError 2] O sistema não pode encontrar o arquivo especificado"
Running `clang-cl /?` gave "[WinError 2] O sistema não pode encontrar o arquivo especificado"
Running `pgcc --version` gave "[WinError 2] O sistema não pode encontrar o arquivo especificado"
A full log can be found at C:\Users\Arthur\AppData\Local\Temp\pip-install-lo_d4nz9\numpy_5d32a18868064226ad139d5718fc80e4\.mesonpy-u1w001bs\meson-logs\meson-log.txt
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed
× Encountered error while generating package metadata. ╰─> numpy
note: This is an issue with the package mentioned above, not pip. hint: See above for details.
Same error on macOS with arm64. As fallback solution, I had to do:
> pip3 install numpy
[ ... and so on, with all dependencies of my project ... ]
> pip3 install opencv-python --no-dep
> pip3 install -e . --no-deps
The workaround for @lucalista didn't exactly work on my Windows computer.
I ran these in a Command Prompt window with administrative rights: python -m pip install numpy python -m pip install opencv-python --no-deps
Later, I was able to run Python as a normal user and "import cv2" without any errors.