generative-models icon indicating copy to clipboard operation
generative-models copied to clipboard

version conflict numpy and cv2

Open omikron88 opened this issue 1 year ago • 2 comments

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

omikron88 avatar Sep 24 '25 15:09 omikron88

My method is uninstalling opencv-python-headless 4.12.0.88.

lsl0007 avatar Nov 10 '25 08:11 lsl0007

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

xXMrNidaXx avatar Feb 25 '26 09:02 xXMrNidaXx