Q:

Python3 Relink issue while importing opencv

Question:
I have a segmentation fault after trying to import a freshly compiled version of the latest available OpenCV from github on Ubuntu 18.04.
Here is the error message I got while trying to import cv2 in Python 3:
$ python3
Python 3.6.8 (default, Aug 20 2019, 17:12:48) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
python3: Relink `/lib/x86_64-linux-gnu/libsystemd.so.0' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
python3: Relink `/lib/x86_64-linux-gnu/libudev.so.1' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
Segmentation fault (core dumped)

My Ubuntu; 5.0.0-29-generic x86_64 GNU/Linux 
From where I cloned OpenCV; https://github.com/opencv/opencv 
Related threads;
getting error while importing cv2 module in ubuntu amazon instance
Configure AWS Redshift on Ubuntu 18.04 and use it with pyodbc
https://unix.stackexchange.com/questions/444697/cannot-run-python-file-asks-to-relink-libraries
https://github.com/tensorflow/tensorflow/issues/19375
None of the solutions presented worked as I do not have any NVidia graphic chips on my laptop;
$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 5500 (rev 09)

Notice:
I need to compile OpenCV from sources because I want to use SIFT and SURF detectors and descriptors and they are no more available when OpenCV is installed with apt:    
>>> import cv2
>>> cv2.__version__
'4.2.0'

>>> cv2.xfeatures2d.SIFT_create()    

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
cv2.error: OpenCV(4.2.0)     
/io/opencv_contrib/modules/xfeatures2d/src/sift.cpp:1210:    
error: (-213:The function/feature is not implemented)     
This algorithm is patented and is excluded in this configuration;    
Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in    
function 'create'

A:

This seems to be caused by version dependency issues.
I faced the same problem, Run the below command
 apt install python3-opencv
This will solve the problem.

