I downloaded openCV from github and built it from source because I need a very specific release from openCV ie openCV2.4 .
I am now trying to run some opensource code. When trying to run one of their provided samples which is written in Python, I get “No module named cv2”. (Their code runs fine on my laptop)
I therefor tried sudo pip install opencv-python.
But this returns Could not find a version that satisfies the requirement opencv-python (from version: ) No match distribution for opencv-python
I also tried turning it the other way around ie sudo pip install python-opencv, but that returns exactly the same.
What can I do to solve the “No module named cv2” issue?
I also tried this straight in the command line
which returns no module named cv2 and
I am however totally able to compile my C++ code. Which means the installation was somehow successful, but something fails on the Python side.
I am affraid this didn’t work neither. I deactivated 3 things in cmake-gui: WITH_OPENCL, WITH_OPENCLAMDBLAS, WITH_OPENCLAMDFFT and activated: BUILD_opencv_python
This is the output I get when just doing cmake after what you told me: https://pastebin.com/TURxzvi1
Thanks for warning me that cuda isn’t activated, didn’t take that into consideration yet.
Although I got past my initial error, I do however still get an error like this one when trying to run my openCV code:
imshow: The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or
Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and
pkg-config, then re-run cmake or configure script
I installed libgtk2.0-dev and pkg-config, selected WITH_QT=ON in the cmake-gui and installed libqt4-dev, but the error persisted.
GTK is different from Qt.
You may leave WITH_QT=OFF unless you need QT backend support.
Try reconfiguring with cmake-gui until it gives no red message (and no red new/modified variable), regenerate, rebuild and re-install. (You may try make clean in your build directory, or better to delete everything and restart from scratch, it will detect your new installation, just be sure to desactivate opencl and configure everything the way you want after the first configure).
One more thing to check is: do you still have opencv4tegra installed ? :
How is set CMAKE_INSTALL_PREFIX ? It is the path where opencv will be installed.
removed the opencv directory, unzipped it again. Did all the steps you mentionned. But still got all those red messages. I think anything related to “haar” has to do with openCV contrib, so I deactivated BUILD_opencv_contrib, but those red messages stayed: https://pastebin.com/0FXqdUPr
ls /usr/lib/libopencv* doesn t show anything related to opencv for tegra. ls /usr/lib/open* shows:
openmpi and openssh in my case, nothing else.
CMAKE_INSTALL_PREFIX is set to /usr/local, while my sources and the build folder are in ~/Downloads .
Although those messages stayed, this once again solved my issue. Thank you very much!