WASasquatch / was-node-suite-comfyui

An extensive node suite for ComfyUI with over 210 new nodes
MIT License
1.23k stars 178 forks source link

Remove restrictions on the opencv version #485

Closed ivan-tolkunov closed 1 month ago

ivan-tolkunov commented 1 month ago

According to blame of requirements.txt the <=4.7.0.72 restriction was added more than a year ago.

Since then, numpy 2 became a thing, and opencv was changed to use numpy 2. Lots of other Comfy plugins use opencv without version restrictions, and pip just installs the latest >= 4.10.

But when installing was-node-suite, because of the <=4.7.0.72 restriction, it downgrades opencv-python-headless to version 4.7.0.72, which uses numpy 1. Pip gladly removes opencv-python-headless 4.10+ and installs the older version, but it doesn't downgrade numpy. Then in the runtime, when importing cv, the import fails with:

A module that was compiled using NumPy 1.x cannot be run in NumPy 2.0.2 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2.

I couldn't figure out why <=4.7.0.72 restriction was needed > year ago. Things seem to work fine without it.

WASasquatch commented 1 month ago

Have you tested all OpenCV related code, and functions? A lot of CV 1.x stuff isn't compatible with 2.0, even with stuff like Ultralytics.

ivan-tolkunov commented 1 month ago

I tested the following: opencv

other

Also, the latest version of opencv and ultralytics supports numpy2 OpenCV Release 84 | Ultralytics Release 8.3.4

ivan-tolkunov commented 1 month ago

@WASasquatch Hey, are there any updates?

WASasquatch commented 1 month ago

Thanks for the work, we'll see if there is any other issues.