Pytorch and Torchvision problem on Jetson Nano

Hi everyone,

I have encountered the problem below, and you can see the print output related to it. I followed the installation steps in the link PyTorch for Jetson in order. In my initial installations, I was getting a ‘core dumped’ error. Later, I tried installing PyTorch version 1.8.1 and torchvision version 0.9.1. Additionally, when removing torch, I installed numpy version 1.19.4. However, when I use the ‘python3 setup.py install --user’ command, I get the output below. I haven’t found the missing point in the installation yet. As I mentioned above, I tried different versions and changed the numpy version. Is there anyone who can help me with the installation? @linux_dev, I think you could directly assist me in this matter :)

In the print output, you can see the versions as the latest one is 0.9.0. I wrote it that way to show you this output, but as I mentioned above, I tried all versions, yet unfortunately, I couldn’t successfully install and use torchvision.

(venv) musa@musa-desktop:~/Desktop/pytorch_deneme3$ git clone --branch v0.9.0 https://github.com/pytorch/vision torchvision
Cloning into 'torchvision'...
remote: Enumerating objects: 429622, done.
remote: Counting objects: 100% (10084/10084), done.
remote: Compressing objects: 100% (1111/1111), done.
remote: Total 429622 (delta 9506), reused 9468 (delta 8958), pack-reused 419538
Receiving objects: 100% (429622/429622), 848.54 MiB | 1.86 MiB/s, done.
Resolving deltas: 100% (398602/398602), done.
Note: checking out '01dfa8ea81972bb74b52dc01e6a1b43b26b62020'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

(venv) musa@musa-desktop:~/Desktop/pytorch_deneme3$ cd torchvision
(venv) musa@musa-desktop:~/Desktop/pytorch_deneme3/torchvision$ export BUILD_VERSION=0.9.0
(venv) musa@musa-desktop:~/Desktop/pytorch_deneme3/torchvision$ python3 setup.py install --user
Building wheel torchvision-0.9.0
PNG found: False
Running build on conda-build: False
Running build on conda: False
JPEG found: True
Building torchvision with JPEG image support
FFmpeg found: True
ffmpeg include path: ['/usr/include', '/usr/include/aarch64-linux-gnu']
ffmpeg library_dir: ['/usr/lib', '/usr/lib/aarch64-linux-gnu']
running install
/home/musa/Desktop/pytorch_deneme3/venv/lib/python3.6/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  setuptools.SetuptoolsDeprecationWarning,
/home/musa/Desktop/pytorch_deneme3/venv/lib/python3.6/site-packages/setuptools/command/easy_install.py:159: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  EasyInstallDeprecationWarning,
Checking .pth file support in /home/musa/.local/lib/python3.6/site-packages/
/home/musa/Desktop/pytorch_deneme3/venv/bin/python3 -E -c pass
TEST FAILED: /home/musa/.local/lib/python3.6/site-packages/ does NOT support .pth files
bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /home/musa/.local/lib/python3.6/site-packages/

and your PYTHONPATH environment variable currently contains:

    ''

Here are some of your options for correcting the problem:

* You can choose a different installation directory, i.e., one that is
  on PYTHONPATH or supports .pth files

* You can add the installation directory to the PYTHONPATH environment
  variable.  (It must then also be on PYTHONPATH whenever you run
  Python and want to use the package(s) you are installing.)

* You can set up the installation directory to support ".pth" files by
  using one of the approaches described here:

  https://setuptools.pypa.io/en/latest/deprecated/easy_install.html#custom-installation-locations


Please make the appropriate changes for your system and try again.
running bdist_egg
running egg_info
creating torchvision.egg-info
writing torchvision.egg-info/PKG-INFO
writing dependency_links to torchvision.egg-info/dependency_links.txt
writing requirements to torchvision.egg-info/requires.txt
writing top-level names to torchvision.egg-info/top_level.txt
writing manifest file 'torchvision.egg-info/SOURCES.txt'
/home/musa/Desktop/pytorch_deneme3/venv/lib/python3.6/site-packages/torch/utils/cpp_extension.py:369: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
  warnings.warn(msg.format('we could not find ninja.'))
reading manifest file 'torchvision.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
adding license file 'LICENSE'
writing manifest file 'torchvision.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-aarch64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-aarch64-3.6
creating build/lib.linux-aarch64-3.6/torchvision
copying torchvision/version.py -> build/lib.linux-aarch64-3.6/torchvision
copying torchvision/utils.py -> build/lib.linux-aarch64-3.6/torchvision
copying torchvision/__init__.py -> build/lib.linux-aarch64-3.6/torchvision
copying torchvision/extension.py -> build/lib.linux-aarch64-3.6/torchvision
creating build/lib.linux-aarch64-3.6/torchvision/models
copying torchvision/models/utils.py -> build/lib.linux-aarch64-3.6/torchvision/models
copying torchvision/models/vgg.py -> build/lib.linux-aarch64-3.6/torchvision/models
copying torchvision/models/__init__.py -> build/lib.linux-aarch64-3.6/torchvision/models
copying torchvision/models/squeezenet.py -> build/lib.linux-aarch64-3.6/torchvision/models
copying torchvision/models/inception.py -> build/lib.linux-aarch64-3.6/torchvision/models
copying torchvision/models/shufflenetv2.py -> build/lib.linux-aarch64-3.6/torchvision/models
copying torchvision/models/mobilenet.py -> build/lib.linux-aarch64-3.6/torchvision/models
copying torchvision/models/resnet.py -> build/lib.linux-aarch64-3.6/torchvision/models
copying torchvision/models/googlenet.py -> build/lib.linux-aarch64-3.6/torchvision/models
copying torchvision/models/densenet.py -> build/lib.linux-aarch64-3.6/torchvision/models
copying torchvision/models/mnasnet.py -> build/lib.linux-aarch64-3.6/torchvision/models
copying torchvision/models/mobilenetv3.py -> build/lib.linux-aarch64-3.6/torchvision/models
copying torchvision/models/mobilenetv2.py -> build/lib.linux-aarch64-3.6/torchvision/models
copying torchvision/models/_utils.py -> build/lib.linux-aarch64-3.6/torchvision/models
copying torchvision/models/alexnet.py -> build/lib.linux-aarch64-3.6/torchvision/models
creating build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/svhn.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/coco.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/utils.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/__init__.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/sbd.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/sbu.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/mnist.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/celeba.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/caltech.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/folder.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/imagenet.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/phototour.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/fakedata.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/ucf101.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/lsun.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/places365.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/stl10.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/semeion.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/flickr.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/video_utils.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/cifar.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/omniglot.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/usps.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/vision.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/widerface.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/hmdb51.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/cityscapes.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/voc.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
copying torchvision/datasets/kinetics.py -> build/lib.linux-aarch64-3.6/torchvision/datasets
creating build/lib.linux-aarch64-3.6/torchvision/ops
copying torchvision/ops/feature_pyramid_network.py -> build/lib.linux-aarch64-3.6/torchvision/ops
copying torchvision/ops/_box_convert.py -> build/lib.linux-aarch64-3.6/torchvision/ops
copying torchvision/ops/__init__.py -> build/lib.linux-aarch64-3.6/torchvision/ops
copying torchvision/ops/poolers.py -> build/lib.linux-aarch64-3.6/torchvision/ops
copying torchvision/ops/focal_loss.py -> build/lib.linux-aarch64-3.6/torchvision/ops
copying torchvision/ops/deform_conv.py -> build/lib.linux-aarch64-3.6/torchvision/ops
copying torchvision/ops/ps_roi_pool.py -> build/lib.linux-aarch64-3.6/torchvision/ops
copying torchvision/ops/misc.py -> build/lib.linux-aarch64-3.6/torchvision/ops
copying torchvision/ops/_register_onnx_ops.py -> build/lib.linux-aarch64-3.6/torchvision/ops
copying torchvision/ops/roi_pool.py -> build/lib.linux-aarch64-3.6/torchvision/ops
copying torchvision/ops/boxes.py -> build/lib.linux-aarch64-3.6/torchvision/ops
copying torchvision/ops/roi_align.py -> build/lib.linux-aarch64-3.6/torchvision/ops
copying torchvision/ops/_utils.py -> build/lib.linux-aarch64-3.6/torchvision/ops
copying torchvision/ops/ps_roi_align.py -> build/lib.linux-aarch64-3.6/torchvision/ops
creating build/lib.linux-aarch64-3.6/torchvision/io
copying torchvision/io/__init__.py -> build/lib.linux-aarch64-3.6/torchvision/io
copying torchvision/io/image.py -> build/lib.linux-aarch64-3.6/torchvision/io
copying torchvision/io/_video_opt.py -> build/lib.linux-aarch64-3.6/torchvision/io
copying torchvision/io/video.py -> build/lib.linux-aarch64-3.6/torchvision/io
creating build/lib.linux-aarch64-3.6/torchvision/transforms
copying torchvision/transforms/functional_pil.py -> build/lib.linux-aarch64-3.6/torchvision/transforms
copying torchvision/transforms/_functional_video.py -> build/lib.linux-aarch64-3.6/torchvision/transforms
copying torchvision/transforms/__init__.py -> build/lib.linux-aarch64-3.6/torchvision/transforms
copying torchvision/transforms/_transforms_video.py -> build/lib.linux-aarch64-3.6/torchvision/transforms
copying torchvision/transforms/functional_tensor.py -> build/lib.linux-aarch64-3.6/torchvision/transforms
copying torchvision/transforms/functional.py -> build/lib.linux-aarch64-3.6/torchvision/transforms
copying torchvision/transforms/autoaugment.py -> build/lib.linux-aarch64-3.6/torchvision/transforms
copying torchvision/transforms/transforms.py -> build/lib.linux-aarch64-3.6/torchvision/transforms
creating build/lib.linux-aarch64-3.6/torchvision/models/detection
copying torchvision/models/detection/__init__.py -> build/lib.linux-aarch64-3.6/torchvision/models/detection
copying torchvision/models/detection/keypoint_rcnn.py -> build/lib.linux-aarch64-3.6/torchvision/models/detection
copying torchvision/models/detection/rpn.py -> build/lib.linux-aarch64-3.6/torchvision/models/detection
copying torchvision/models/detection/anchor_utils.py -> build/lib.linux-aarch64-3.6/torchvision/models/detection
copying torchvision/models/detection/retinanet.py -> build/lib.linux-aarch64-3.6/torchvision/models/detection
copying torchvision/models/detection/transform.py -> build/lib.linux-aarch64-3.6/torchvision/models/detection
copying torchvision/models/detection/image_list.py -> build/lib.linux-aarch64-3.6/torchvision/models/detection
copying torchvision/models/detection/backbone_utils.py -> build/lib.linux-aarch64-3.6/torchvision/models/detection
copying torchvision/models/detection/roi_heads.py -> build/lib.linux-aarch64-3.6/torchvision/models/detection
copying torchvision/models/detection/mask_rcnn.py -> build/lib.linux-aarch64-3.6/torchvision/models/detection
copying torchvision/models/detection/generalized_rcnn.py -> build/lib.linux-aarch64-3.6/torchvision/models/detection
copying torchvision/models/detection/_utils.py -> build/lib.linux-aarch64-3.6/torchvision/models/detection
copying torchvision/models/detection/faster_rcnn.py -> build/lib.linux-aarch64-3.6/torchvision/models/detection
creating build/lib.linux-aarch64-3.6/torchvision/models/segmentation
copying torchvision/models/segmentation/segmentation.py -> build/lib.linux-aarch64-3.6/torchvision/models/segmentation
copying torchvision/models/segmentation/__init__.py -> build/lib.linux-aarch64-3.6/torchvision/models/segmentation
copying torchvision/models/segmentation/fcn.py -> build/lib.linux-aarch64-3.6/torchvision/models/segmentation
copying torchvision/models/segmentation/lraspp.py -> build/lib.linux-aarch64-3.6/torchvision/models/segmentation
copying torchvision/models/segmentation/_utils.py -> build/lib.linux-aarch64-3.6/torchvision/models/segmentation
copying torchvision/models/segmentation/deeplabv3.py -> build/lib.linux-aarch64-3.6/torchvision/models/segmentation
creating build/lib.linux-aarch64-3.6/torchvision/models/quantization
copying torchvision/models/quantization/utils.py -> build/lib.linux-aarch64-3.6/torchvision/models/quantization
copying torchvision/models/quantization/__init__.py -> build/lib.linux-aarch64-3.6/torchvision/models/quantization
copying torchvision/models/quantization/inception.py -> build/lib.linux-aarch64-3.6/torchvision/models/quantization
copying torchvision/models/quantization/shufflenetv2.py -> build/lib.linux-aarch64-3.6/torchvision/models/quantization
copying torchvision/models/quantization/mobilenet.py -> build/lib.linux-aarch64-3.6/torchvision/models/quantization
copying torchvision/models/quantization/resnet.py -> build/lib.linux-aarch64-3.6/torchvision/models/quantization
copying torchvision/models/quantization/googlenet.py -> build/lib.linux-aarch64-3.6/torchvision/models/quantization
copying torchvision/models/quantization/mobilenetv3.py -> build/lib.linux-aarch64-3.6/torchvision/models/quantization
copying torchvision/models/quantization/mobilenetv2.py -> build/lib.linux-aarch64-3.6/torchvision/models/quantization
creating build/lib.linux-aarch64-3.6/torchvision/models/video
copying torchvision/models/video/__init__.py -> build/lib.linux-aarch64-3.6/torchvision/models/video
copying torchvision/models/video/resnet.py -> build/lib.linux-aarch64-3.6/torchvision/models/video
creating build/lib.linux-aarch64-3.6/torchvision/datasets/samplers
copying torchvision/datasets/samplers/__init__.py -> build/lib.linux-aarch64-3.6/torchvision/datasets/samplers
copying torchvision/datasets/samplers/clip_sampler.py -> build/lib.linux-aarch64-3.6/torchvision/datasets/samplers
running build_ext
building 'torchvision._C' extension
creating build/temp.linux-aarch64-3.6
creating build/temp.linux-aarch64-3.6/home
creating build/temp.linux-aarch64-3.6/home/musa
creating build/temp.linux-aarch64-3.6/home/musa/Desktop
creating build/temp.linux-aarch64-3.6/home/musa/Desktop/pytorch_deneme3
creating build/temp.linux-aarch64-3.6/home/musa/Desktop/pytorch_deneme3/torchvision
creating build/temp.linux-aarch64-3.6/home/musa/Desktop/pytorch_deneme3/torchvision/torchvision
creating build/temp.linux-aarch64-3.6/home/musa/Desktop/pytorch_deneme3/torchvision/torchvision/csrc
creating build/temp.linux-aarch64-3.6/home/musa/Desktop/pytorch_deneme3/torchvision/torchvision/csrc/ops
creating build/temp.linux-aarch64-3.6/home/musa/Desktop/pytorch_deneme3/torchvision/torchvision/csrc/ops/autocast
creating build/temp.linux-aarch64-3.6/home/musa/Desktop/pytorch_deneme3/torchvision/torchvision/csrc/ops/autograd
creating build/temp.linux-aarch64-3.6/home/musa/Desktop/pytorch_deneme3/torchvision/torchvision/csrc/ops/cpu
creating build/temp.linux-aarch64-3.6/home/musa/Desktop/pytorch_deneme3/torchvision/torchvision/csrc/ops/cuda
aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/home/musa/Desktop/pytorch_deneme3/torchvision/torchvision/csrc -I/home/musa/Desktop/pytorch_deneme3/venv/lib/python3.6/site-packages/torch/include -I/home/musa/Desktop/pytorch_deneme3/venv/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/musa/Desktop/pytorch_deneme3/venv/lib/python3.6/site-packages/torch/include/TH -I/home/musa/Desktop/pytorch_deneme3/venv/lib/python3.6/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/musa/Desktop/pytorch_deneme3/venv/include -I/usr/include/python3.6m -c /home/musa/Desktop/pytorch_deneme3/torchvision/torchvision/csrc/ops/autocast/deform_conv2d_kernel.cpp -o build/temp.linux-aarch64-3.6/home/musa/Desktop/pytorch_deneme3/torchvision/torchvision/csrc/ops/autocast/deform_conv2d_kernel.o -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++14

---------------------------------------------------------------------------------------------------------------------------------
PIL SETUP SUMMARY
--------------------------------------------------------------------
version      Pillow 10.1.0
platform     linux 3.6.9 (default, Mar 10 2023, 16:46:00)
             [GCC 8.4.0]
--------------------------------------------------------------------
--- JPEG support available
*** OPENJPEG (JPEG2000) support not available
--- ZLIB (PNG/ZIP) support available
*** LIBIMAGEQUANT support not available
*** LIBTIFF support not available
*** FREETYPE2 support not available
*** RAQM (Text shaping) support not available
*** LITTLECMS2 support not available
*** WEBP support not available
*** WEBPMUX support not available
--- XCB (X protocol) support available
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library and headers.
See https://pillow.readthedocs.io/en/latest/installation.html#building-from-source

To check the build, run the selftest.py script.

  File "build/bdist.linux-aarch64/egg/PIL/_deprecate.py", line 1
    from __future__ import annotations
                                     ^
SyntaxError: future feature annotations is not defined

Moving Pillow-10.1.0-py3.6-linux-aarch64.egg to /home/musa/.local/lib/python3.6/site-packages

Installed /home/musa/.local/lib/python3.6/site-packages/Pillow-10.1.0-py3.6-linux-aarch64.egg
Searching for torch==1.8.0
Best match: torch 1.8.0
Installing convert-caffe2-to-onnx script to /home/musa/.local/bin
Installing convert-onnx-to-caffe2 script to /home/musa/.local/bin

Using /home/musa/Desktop/pytorch_deneme3/venv/lib/python3.6/site-packages
Searching for numpy==1.19.4
Best match: numpy 1.19.4
Installing f2py script to /home/musa/.local/bin
Installing f2py3 script to /home/musa/.local/bin
Installing f2py3.6 script to /home/musa/.local/bin

Using /home/musa/Desktop/pytorch_deneme3/venv/lib/python3.6/site-packages
Searching for typing-extensions==4.1.1
Best match: typing-extensions 4.1.1

Using /home/musa/Desktop/pytorch_deneme3/venv/lib/python3.6/site-packages
Searching for dataclasses==0.8
Best match: dataclasses 0.8

Using /home/musa/Desktop/pytorch_deneme3/venv/lib/python3.6/site-packages
Finished processing dependencies for torchvision==0.9.0

Hi,

Have you tried it?

From the log message, TorchVision is installed although there are some error-like messages shown.

Thanks

1 Like

Today, I worked on it a bit, and I think the issue is with OpenCV. My torch version is 1.8.0, torchvision version is 0.9.0, and torch is enabled for CUDA. Everything is fine up to this point. Now, in the virtual environment, I install OpenCV 4.8.0 to the created directory. Here, to enable CUDA, I modify the CMakeLists file with the cmake command. I’ve done everything, and finally, I wait for it to compile by using ‘make -j4.’ However, there’s a problem: it reaches 64%, and the Jetson Nano freezes. I waited for 2-3 hours, but there was no change. So, I restarted the Jetson Nano, created the build files again, and ran ‘make -j4’ once more. Do you think I’m making a mistake somewhere? My goal is to create a simple code for object detection using OpenCV, PyTorch, and torchvision. I want to train the model with YOLO and run it on the Jetson Nano GPU to detect objects. I also want to perform non-specific tasks like finding the distance between two objects.

More than likely you ran out of memory trying to compile OpenCV using the -j4 command. It spends all of its time memory thrashing. Use one only one core (-j1) Many people use the community’s Michael de Gans script: GitHub - mdegans/nano_build_opencv: Build OpenCV on Nvidia Jetson Nano

I think it makes more sense to have a separate build for OpenCV and package it. Then you can easily install it from the package script without having all of the OpenCV build artifacts on your new system.

@musa.karagoz I have some precompiled packages for OpenCV+CUDA that you can find the URLs for here:

@dusty_nv Thank you for sharing. Should I perform the installation using the link you provided in a virtual environment or directly on a freshly installed Jetson Nano? For instance, there are steps mentioned on the Augmented Startups YouTube channel, where they explain the installation with examples for version 4.1.2 with CUDA support. I followed each step yesterday, and the installation took about 4 hours. However, when I woke up this morning, I opened the terminal, navigated to the main directory of my virtual environment, and when I entered ‘python3’ and tried to import cv2, it gave me a ‘ModuleNotFoundError: No module named ‘cv2’’ warning. What should be the approach? Should I reset the SD card and perform a fresh installation using the link you provided?

@musa.karagoz I personally use containers instead of virtual environments, so I never have to worry about trashing my install, so your call how to proceed. Those downloads I provided are tarballs of the .deb packages output by the OpenCV build. It should take just a minute to install them.

You can see how I install the OpenCV build artifacts in this script:

https://github.com/dusty-nv/jetson-containers/blob/086fae178ea6c900fdf0ca56e5373c8c15ac8747/packages/opencv/opencv_install.sh#L28

# remove previous OpenCV installation if it exists
apt-get purge -y '.*opencv.*' || echo "previous OpenCV installation not found"

# download and extract the deb packages
mkdir opencv
cd opencv
wget --quiet --show-progress --progress=bar:force:noscroll --no-check-certificate ${OPENCV_URL} -O ${OPENCV_DEB}
tar -xzvf ${OPENCV_DEB}

# install the packages and their dependencies
dpkg -i --force-depends *.deb
apt-get update 
apt-get install -y -f --no-install-recommends
dpkg -i *.deb
rm -rf /var/lib/apt/lists/*
apt-get clean

# test importing cv2
echo "testing cv2 module under python..."
python3 -c "import cv2; print('OpenCV version:', str(cv2.__version__)); print(cv2.getBuildInformation())"

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