Can't install OpenCV into Jetson Nano with Python3.9

Hi everyone,

I’m encountering issues with OpenCV, specifically while trying to import the cv2 module in Python 3.9 on my Jetson Nano. Although I’ve followed various articles online, I seem to be stuck at this point.

I referenced this NVIDIA developer forum topic, but I’ve found that some GitHub repositories mentioned in those articles have been removed, which complicates things further.

CMake Configuration

I configured CMake with the following command:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
-D EIGEN_INCLUDE_PATH=/usr/include/eigen3 \
-D WITH_OPENCL=OFF \
-D WITH_CUDA=ON \
-D CUDA_ARCH_BIN=5.3 \
-D CUDA_ARCH_PTX="" \
-D WITH_CUDNN=ON \
-D WITH_CUBLAS=ON \
-D ENABLE_FAST_MATH=ON \
-D CUDA_FAST_MATH=ON \
-D OPENCV_DNN_CUDA=ON \
-D ENABLE_NEON=ON \
-D WITH_QT=OFF \
-D WITH_OPENMP=ON \
-D BUILD_TIFF=ON \
-D WITH_FFMPEG=ON \
-D WITH_GSTREAMER=ON \
-D WITH_TBB=ON \
-D BUILD_TBB=ON \
-D BUILD_TESTS=OFF \
-D WITH_EIGEN=ON \
-D WITH_V4L=ON \
-D WITH_LIBV4L=ON \
-D OPENCV_ENABLE_NONFREE=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D BUILD_opencv_python3=TRUE \
-D PYTHON_EXECUTABLE=/home/nvidia/opencv_env/bin/python3.9 \
-D PYTHON3_PACKAGES_PATH=/home/nvidia/opencv_env/lib/python3.9/site-packages \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D PYTHON_LIBRARY=/usr/local/lib/libpython3.9.so \
-D PYTHON_NUMPY_INCLUDE_DIRS=$(python3.9 -c "import numpy; print(numpy.get_include())") \
-D BUILD_EXAMPLES=OFF .. >> config.log

Current Situation

Despite having installed NumPy, the build process indicates that it was not included.

I’ve also come across suggestions to use Python 3.6.9, but I’m currently working with the Ultralyics repository, which requires Python 3.8 or higher.

References

I followed this article but am still facing difficulties.

If anyone has insights on how to resolve this issue or if you need more information about my setup, please let me know.

This is all log file
build.log (198.2 KB)
config.log (40.7 KB)
install.log (88.4 KB)

Thank you!


Hi,
Later python version does not work on Jetpack 4. Please use python 3.6 or 3.8.

Here is a related topic:
TensorRT for Python3.8 Jetson Nano python bindings

A user shares a script for building OpenCV:
GitHub - mdegans/nano_build_opencv: Build OpenCV on Nvidia Jetson Nano

Thanks sir, I’ve installed it successfully

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