Hello,
I’m messing up when trying to install openCV from sources.
System: Ubuntu 18.04
OpenCV Version: 4.5.2 (latest)
Python: Python 3.8 and 3.9 (via anaconda)
Tutorial followed - How to install OpenCV 4.5 with CUDA 11.2 in Ubuntu 20.04 · GitHub
I’ve followed above tutorial, using anaconda python.
Isaac@MSI:~/opencv-4.5.2/build/python_loader$ python setup.py install
running install
running bdist_egg
running egg_info
writing opencv.egg-info/PKG-INFO
writing dependency_links to opencv.egg-info/dependency_links.txt
writing requirements to opencv.egg-info/requires.txt
writing top-level names to opencv.egg-info/top_level.txt
reading manifest file 'opencv.egg-info/SOURCES.txt'
writing manifest file 'opencv.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/cv2
copying build/lib/cv2/load_config_py2.py -> build/bdist.linux-x86_64/egg/cv2
copying build/lib/cv2/config.py -> build/bdist.linux-x86_64/egg/cv2
copying build/lib/cv2/load_config_py3.py -> build/bdist.linux-x86_64/egg/cv2
copying build/lib/cv2/__init__.py -> build/bdist.linux-x86_64/egg/cv2
byte-compiling build/bdist.linux-x86_64/egg/cv2/load_config_py2.py to load_config_py2.cpython-39.pyc
byte-compiling build/bdist.linux-x86_64/egg/cv2/config.py to config.cpython-39.pyc
byte-compiling build/bdist.linux-x86_64/egg/cv2/load_config_py3.py to load_config_py3.cpython-39.pyc
byte-compiling build/bdist.linux-x86_64/egg/cv2/__init__.py to __init__.cpython-39.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying opencv.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying opencv.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying opencv.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying opencv.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying opencv.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
cv2.__pycache__.__init__.cpython-39: module references __file__
creating 'dist/opencv-4.5.2-py3.9.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing opencv-4.5.2-py3.9.egg
removing '/home/isaac/anaconda3/envs/cv/lib/python3.9/site-packages/opencv-4.5.2-py3.9.egg' (and everything under it)
creating /home/isaac/anaconda3/envs/cv/lib/python3.9/site-packages/opencv-4.5.2-py3.9.egg
Extracting opencv-4.5.2-py3.9.egg to /home/isaac/anaconda3/envs/cv/lib/python3.9/site-packages
opencv 4.5.2 is already the active version in easy-install.pth
Installed /home/isaac/anaconda3/envs/cv/lib/python3.9/site-packages/opencv-4.5.2-py3.9.egg
Processing dependencies for opencv==4.5.2
Searching for numpy==1.20.1
Best match: numpy 1.20.1
Adding numpy 1.20.1 to easy-install.pth file
Installing f2py script to /home/isaac/anaconda3/envs/cv/bin
Installing f2py3 script to /home/isaac/anaconda3/envs/cv/bin
Installing f2py3.9 script to /home/isaac/anaconda3/envs/cv/bin
Using /home/isaac/anaconda3/envs/cv/lib/python3.9/site-packages
Finished processing dependencies for opencv==4.5.2
But when trying to import cv2 and check that everything works, this error arrise:
(cv) isaac@MSI:~/opencv-4.5.2/build/python_loader$ python
Python 3.9.4 (default, Apr 9 2021, 16:34:09)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/isaac/opencv-4.5.2/build/python_loader/cv2/__init__.py", line 102, in <module>
bootstrap()
File "/home/isaac/opencv-4.5.2/build/python_loader/cv2/__init__.py", line 63, in bootstrap
load_first_config([
File "/home/isaac/opencv-4.5.2/build/python_loader/cv2/__init__.py", line 60, in load_first_config
raise ImportError('OpenCV loader: missing configuration file: {}. Check OpenCV installation.'.format(fnames))
ImportError: OpenCV loader: missing configuration file: ['config-3.9.py', 'config-3.py']. Check OpenCV installation.
>>> exit()
I’ve not found so many discussions with config-3.py
or any other variant related with the lines above. I’ve just found the solution of using pip install --upgrade opencv-python
which was something I was trying to avoid
Am I missing sth? Is there a way to debug the line 60
error and not install opencv-pyhton