ImportError: libopencv_shape.so.3.2: cannot open shared object file: No such file or directory

I am currently trying out PYNQ-ComputerVision . After installation I tried out the 3a_Overlays-stereo_block_matching.ipynb Notebook but I get this ImportError and don’t know why. Would be awesome if you know what my problem is. Thank you in advance!

Did you upgrade opencv? The default one that comes with image v2.5 is opencv3.2; I guess computervision is assuming you have the default opencv. So if you have upgraded your opencv, that may break their code.

Thank you for your time and answering my question!
I checked the version and yes you are indeed right I somehow installed opencv version 3.4.3, but not intentionally haha. I used this command to install PYNQ-ComputerVision
sudo pip3 install --upgrade git+https://github.com/Xilinx/PYNQ-ComputerVision.git. I am quite a noob, but when I remember correctly the “–upgrade” flag tries to upgrade the used packages :thinking:. So I guess it upgraded opencv during the installation. I am not sure how opencv is installed in the PYNQ Platform. (cause I think it is also using the Xilinx xfOpenCV library). I also didn’t find further information in the PYNQ documentation. I would be happen, if you know where I can find the informations to dive deeper into the topic :heart_eyes:.
I tried to downgrade opencv to 3.2 with this command:
pip3 install opencv-python==3.2 but get an error message:

Could not find a version that satisfies the requirement opencv-python==3.2

I am still in the process to understand the whole system, so thank you very much for helping me!

Best greetings,

Noah :smile:

Opencv3.2 can be installed using apt-get. In https://github.com/Xilinx/PYNQ/blob/master/sdbuild/ubuntu/bionic/aarch64/multistrap.config
find all opencv related package (searching opencv keyword), and install them. Something like:

apt-get install libopencv-calib3d-dev

Alternative way is to install from source, using the well-known cmake flow. pip install won’t upgrade any of your opencv package since we did not put opencv in the dependency list in setup.py.

2 Likes

Awesome it worked. Thank you soo much rock for your help and for your precious time!!! :heart_eyes: :heart:

I actually didn’t fully understand why, I checked the opencv version with:

import cv2
print(cv2.__version__)

I still have the same version: 3.4.3

I’ve read a little into it here: https://github.com/Xilinx/PYNQ/tree/master/sdbuild
Just for my understanding how the system works:
Have I got it right that the multistrap.config is a list of supported packages for PYNQ that is not activated by default? And that this also enables the Ubuntu 18.04 host support?

The cv2 python package is still 3.4, but I think you can manually uninstall it. Right now you have the c libraries installed as 3.2, but I guess the python package is still 3.4. The best practice is to make them consistent - you can remove all the opencv installation and just use apt-get install to install 3.2.

Ahh okay, I understand. Thank you for your advice! :relaxed: