version conflict numpy and cv2
Hello, How to install and make it working? In both Win and Linux it says that numpy is compiled with one ABI version but cv2 with another. And it crashes.
How did I install it?
conda create -n generative-models python=3.10 conda activate generative-models
git clone https://github.com/Stability-AI/generative-models.git cd generative-models
pip install wheel pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 pip install -r .\requirements\pt2.txt pip install .
python -m scripts.demo.gradio_app_sv4d
My method is uninstalling opencv-python-headless 4.12.0.88.
NumPy 2.0 + OpenCV compatibility issues are widespread right now.
Quick fix:
pip install "numpy<2.0" opencv-python
Or force reinstall in order:
pip uninstall numpy opencv-python -y
pip install numpy==1.26.4
pip install opencv-python
For requirements.txt:
numpy>=1.24,<2.0
opencv-python>=4.8
Root cause: OpenCV binaries were built against NumPy 1.x ABI. NumPy 2.0 changed the C API, causing crashes like:
AttributeError: module numpy has no attribute bool
Long-term fix: Wait for opencv-python to release NumPy 2.0 compatible wheels, or build from source.
Building generative AI? https://www.revolutionai.io/find-work