OpenCV with CUDA (Ubuntu 22.04), python import error: "undefined symbol: gst_base_src_new_segment"
I attempted to build OpenCV with CUDA support for my 6.1 compute compatible GPU on my Ubuntu 22.04 OS. After lots of struggle I finally got the installation to complete without errors (but with 4 "harmless" repeating warnings) by using OpenCV 4.2.0, Nvidia Toolkit 11.5, gcc and g++ 10.4.0, and python 3.10.6 (in a virtual environment in anaconda). when I check the installation using "pkg-config --libs opencv" I get an error saying it doesn't exist, and when I try to import opencv in the anaconda environment I get the error /lib/x86_64-linux-gnu/libgstapp-1.0.so.0: undefined symbol: gst_base_src_new_segment
, which occurs in cv2/__init__.py
when executing bootstrap().
The installation results in lots of promising looking .h, .hpp and .so files. I have not installed packages from scratch like this before so I am not sure how to tell if the installation was successful or not. The error I get is the best-case I was able to achieve by experimenting with various versions of gcc, nvidia toolkit, and OpenCV, and I need to run conda install -c conda-forge gcc=10.4.0
or else I get a different error (which is interesting since I followed https://danielhavir.github.io/notes/install-opencv/ for the most part in the installation process, and they did not mention needing to do that. I could not find cv2.so in the list of installed files. I noticed that python 3.10.6 was compiled with gcc 11.2.0. could this be the issue? I have spent a week and a half to get to this point but I am not sure if these are fixable issues within python or if the errors are a sign of a broader issue with the installation and require a new compile.
edit: I discovered the issue is that Ubuntu 22.04 comes standard with gstreamer 1.20 but anaconda-navigator appears to use gstreamer 1.14.0. "gst_base_src_new_segment" was added in 1.18 and this is why anaconda gets stuck. I can either downgrade my system's gstreamer or upgrade my anaconda gstreamer. However, when I try to remove gstreamer from anaconda-navigator (conda uninstall gstreamer
) it tries to uninstall anaconda-navigator itself and when I try to upgrade gstreamer using conda install -c anaconda gstreamer
it tries to install the 1.14.0 version unless I specify otherwise. Installing gstreamer 1.20.3 using conda install -c fastchan gstreamer
does not change the core library version.
Comments
Post a Comment