Best way to setup python OpenCV for development on Arch Linux?


I need to use some modules that are not included in the PyPi version of OpenCV, fort instance Viz3D. I’ve been tearing my hair out trying to figure out a proper setup and I’m still confused.

The opencv package in the arch repos is great, but the python-opencv is just a shared object so no way of getting intellisense in VS Code.

conda opencv is heavy as hell and does the same thing: no intellisense.

pip opencv-contrib-python has intellisense but not compiled with Viz3D and is messing up with system-installed Qt5 which leads to segfaults at the moment.

I’d like to keep my system clean and use a virtualenv. For now, I’m using pipenv with --site-packages option to get access to the arch version of python-opencv.

Is there a way to get all the good stuff? Intellisense + Viz3D + in a virtualenv? Or should I give up and switch to C++ :grimacing:?

this unfortunately means: you have to build from src
since Viz3D draws most functionality from VTK, you need to have that installed before.

(but hopefully, you can get around the qt issue like that, by either using your local qt or switching to gtk)

Does building from source provide python bindings and the required files for intellisense?

i’ve no idea, what is required for intellisense, but yes it will build python bindings