Jetson AGX with multiple newer Python version

Hi,

I have a Jetson AGX with JetPack 4.5. I have uninstalled openCV 4.1.1. I have installed Python 3.8 by building it from source. Then I installed opencv 4.2.0 from source built with CMake. I see opencv 4.2.0 is installed in site-packages for Python 2.7 and 3.6.9. But not for Python 3.8. I have spent an entire day trying to figure out how to get opencv installed for Python 3.8 and nothing has worked. Python 3.8 has been installed in alternate location /use/local/lib.

Here is my CMake configuration attributes -
sudo cmake -D WITH_CUDA=ON -D WITH_CUDNN=ON -D CUDA_ARCH_BIN=“5.3,6.2,7.2” -D CUDA_ARCH_PTX="" -D OPENCV_GENERATE_PKGCONFIG=ON -D OPENCV_EXTRA_MODULES_PATH=…/…/opencv_contrib-4.2.0/modules -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D BUILD_opencv_python2=ON -D BUILD_opencv_python3=ON -D HAVE_opencv_python3=ON -D PYTHON_DEFAULT_EXECUTABLE=${which python3.8} -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local …

Have a reference to this topic.

That didn’t really solve but I did some digging in OpenCV’s root CMakeList.txt and was able to set a few additional attributes which resolved my problem. It still created a sub-folder for the install path as python3.6. However, it used python3.8 interpreter for building.

sudo cmake -D WITH_CUDA=ON -D WITH_CUDNN=ON -D CUDA_ARCH_BIN=“5.3,6.2,7.2” -D CUDA_ARCH_PTX="" -D OPENCV_GENERATE_PKGCONFIG=ON -D OPENCV_EXTRA_MODULES_PATH=…/…/opencv_contrib-4.2.0/modules -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_opencv_python3=ON -D HAVE_opencv_python3=ON -D PYTHON3_VERSION_STRING=3.8.11 -D PYTHON3LIBS_VERSION_STRING=3.8.11 -D PYTHON3_EXECUTABLE=/usr/local/lib/python3.8 -D PYTHON3_INCLUDE_DIR=/usr/local/include/python3.8 -D PYTHON3_PACKAGES_PATH=/usr/local/lib/python3.8/dist-packages -D PYTHON3_NUMPY_INCLUDE_DIRS=/home/tech-user/.local/lib/python3.8/site-packages -D PYTHON3_LIBRARIES=/usr/local/lib/python3.8.a -D PYTHON_INCLUDE_DIR=/usr/local/include/python3.8 -D OPENCV_PYTHON3_INSTALL_PATH=/usr/local/lib/python3.8/dist-packages -D INSTALL_PATH_PYTHON3=/usr/local/lib/python3.8/dist-packages -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local …

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.