dusty-nv / jetson-containers

Machine Learning Containers for NVIDIA Jetson and JetPack-L4T
MIT License
2.13k stars 440 forks source link

Build ROS Iron on Jetson Nano fails with opencv image build ImportError #323

Closed michael-schaefer-eu closed 10 months ago

michael-schaefer-eu commented 10 months ago

I have a Jetson Nano on which I try to build the ROS Iron which fails.

Jetpack 4.6.4 L4T 32.7.4 Cuda 10.2.300 OpenCV 4.1.1

When I run ./build.sh ros:iron-ros-base I get the following error when the opencv image is built:

#8 79.12 Traceback (most recent call last):
#8 79.12   File "<string>", line 1, in <module>
#8 79.12   File "/usr/local/lib/python3.6/dist-packages/cv2/__init__.py", line 96, in <module>
#8 79.12     bootstrap()
#8 79.12   File "/usr/local/lib/python3.6/dist-packages/cv2/__init__.py", line 86, in bootstrap
#8 79.12     import cv2
#8 79.12 ImportError: libcublas.so.10: cannot open shared object file: No such file or directory
#8 ERROR: process "/bin/sh -c cd /opt && ./opencv_install.sh" did not complete successfully: exit code: 1

From the logs:

logs/20231106_122338/build/opencv_r32.7.4-opencv.sh

#!/usr/bin/env bash

docker build --network=host --tag opencv:r32.7.4-opencv \
--file /home/jetbot/jetbot-usb/jetson-containers/packages/opencv/Dockerfile \
--build-arg BASE_IMAGE=opencv:r32.7.4-numpy \
--build-arg OPENCV_URL="https://nvidia.box.com/shared/static/5v89u6g5rb62fpz4lh0rz531ajo2t5ef.gz" \
--build-arg OPENCV_DEB="OpenCV-4.5.0-aarch64.tar.gz" \
/home/jetbot/jetbot-usb/jetson-containers/packages/opencv \
2>&1 | tee /home/jetbot/jetbot-usb/jetson-containers/logs/20231106_122338/build/opencv_r32.7.4-opencv.txt; exit ${PIPESTATUS[0]}

logs/20231106_122338/build/opencv_r32.7.4-opencv.txt

#1 [internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.1s

#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 677B 0.0s done
#2 DONE 0.1s

#3 [internal] load metadata for docker.io/library/opencv:r32.7.4-numpy
#3 DONE 0.0s

#4 [internal] load build context
#4 transferring context: 39B done
#4 DONE 0.1s

#5 [1/4] FROM docker.io/library/opencv:r32.7.4-numpy
#5 DONE 0.4s

#6 [2/4] COPY opencv_install.sh /opt/opencv_install.sh
#6 DONE 0.1s

#7 [3/4] RUN cd /opt &&     sed -i "2i OPENCV_URL=https://nvidia.box.com/shared/static/5v89u6g5rb62fpz4lh0rz531ajo2t5ef.gz" opencv_install.sh &&     sed -i "3i OPENCV_DEB=OpenCV-4.5.0-aarch64.tar.gz" opencv_install.sh &&     cat opencv_install.sh
#7 0.249 #!/usr/bin/env bash
#7 0.249 OPENCV_URL=https://nvidia.box.com/shared/static/5v89u6g5rb62fpz4lh0rz531ajo2t5ef.gz
#7 0.249 OPENCV_DEB=OpenCV-4.5.0-aarch64.tar.gz
#7 0.249 OPENCV_URL=${1:-"$OPENCV_URL"}
#7 0.249 OPENCV_DEB=${2:-"$OPENCV_DEB"}
#7 0.249 
#7 0.249 echo "OPENCV_URL=$OPENCV_URL"
#7 0.249 echo "OPENCV_DEB=$OPENCV_DEB"
#7 0.249 
#7 0.249 if [[ -z ${OPENCV_URL} || -z ${OPENCV_DEB} ]]; then
#7 0.249    echo "OPENCV_URL and OPENCV_DEB must be set as environment variables or as command-line arguments"
#7 0.249    exit 255
#7 0.249 fi
#7 0.249 
#7 0.249 ARCH=$(uname -i)
#7 0.249 echo "ARCH:  $ARCH"
#7 0.249 
#7 0.249 set -x
#7 0.249 
#7 0.249 # install numpy if needed
#7 0.249 python3 -c 'import numpy'
#7 0.249 
#7 0.249 if [ $? != 0 ]; then
#7 0.249    apt-get update
#7 0.249    apt-get install -y --no-install-recommends python3-numpy
#7 0.249 fi
#7 0.249 
#7 0.249 set -e
#7 0.249 
#7 0.249 # remove previous OpenCV installation if it exists
#7 0.249 apt-get purge -y '.*opencv.*' || echo "previous OpenCV installation not found"
#7 0.249 
#7 0.249 # download and extract the deb packages
#7 0.249 mkdir opencv
#7 0.249 cd opencv
#7 0.249 wget --quiet --show-progress --progress=bar:force:noscroll --no-check-certificate ${OPENCV_URL} -O ${OPENCV_DEB}
#7 0.249 tar -xzvf ${OPENCV_DEB}
#7 0.249 
#7 0.249 # install the packages and their dependencies
#7 0.249 dpkg -i --force-depends *.deb
#7 0.249 apt-get update 
#7 0.249 apt-get install -y -f --no-install-recommends
#7 0.249 dpkg -i *.deb
#7 0.249 rm -rf /var/lib/apt/lists/*
#7 0.249 apt-get clean
#7 0.249 
#7 0.249 # remove the original downloads
#7 0.249 cd ../
#7 0.249 rm -rf opencv
#7 0.249 
#7 0.249 # manage some install paths
#7 0.249 PYTHON3_VERSION=`python3 -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}".format(*version))'`
#7 0.249 
#7 0.249 if [ $ARCH = "aarch64" ]; then
#7 0.249    local_include_path="/usr/local/include/opencv4"
#7 0.249    local_python_path="/usr/local/lib/python${PYTHON3_VERSION}/dist-packages/cv2"
#7 0.249 
#7 0.249    if [ -d "$local_include_path" ]; then
#7 0.249        echo "$local_include_path already exists, replacing..."
#7 0.249        rm -rf $local_include_path
#7 0.249    fi
#7 0.249    
#7 0.249    if [ -d "$local_python_path" ]; then
#7 0.249        echo "$local_python_path already exists, replacing..."
#7 0.249        rm -rf $local_python_path
#7 0.249    fi
#7 0.249    
#7 0.249    ln -s /usr/include/opencv4 $local_include_path
#7 0.249    ln -s /usr/lib/python${PYTHON3_VERSION}/dist-packages/cv2 $local_python_path
#7 0.249    
#7 0.249 elif [ $ARCH = "x86_64" ]; then
#7 0.249    opencv_conda_path="/opt/conda/lib/python${PYTHON3_VERSION}/site-packages/cv2"
#7 0.249    
#7 0.249    if [ -d "$opencv_conda_path" ]; then
#7 0.249        echo "$opencv_conda_path already exists, replacing..."
#7 0.249        rm -rf $opencv_conda_path
#7 0.249        ln -s /usr/lib/python${PYTHON3_VERSION}/site-packages/cv2 $opencv_conda_path
#7 0.249    fi
#7 0.249 fi
#7 0.249 
#7 0.249 # test importing cv2
#7 0.249 echo "testing cv2 module under python..."
#7 0.249 python3 -c "import cv2; print('OpenCV version:', str(cv2.__version__)); print(cv2.getBuildInformation())"
#7 DONE 0.3s
[...]
#8 [4/4] RUN cd /opt && ./opencv_install.sh
#8 0.250 OPENCV_URL=https://nvidia.box.com/shared/static/5v89u6g5rb62fpz4lh0rz531ajo2t5ef.gz
#8 0.250 OPENCV_DEB=OpenCV-4.5.0-aarch64.tar.gz
#8 0.253 ARCH:  aarch64
#8 0.253 + python3 -c 'import numpy'
#8 0.813 + '[' 0 '!=' 0 ']'
#8 0.813 + set -e
#8 0.813 + apt-get purge -y '.*opencv.*'
#8 0.832 Reading package lists...
#8 0.876 Building dependency tree...
#8 0.880 Reading state information...
#8 0.893 E: Unable to locate package .*opencv.*
#8 0.893 E: Couldn't find any package by glob '.*opencv.*'
#8 0.893 E: Couldn't find any package by regex '.*opencv.*'
#8 0.894 + echo 'previous OpenCV installation not found'
#8 0.895 + mkdir opencv
#8 0.895 previous OpenCV installation not found
#8 0.908 + cd opencv
#8 0.908 + wget --quiet --show-progress --progress=bar:force:noscroll --no-check-certificate https://nvidia.box.com/shared/static/5v89u6g5rb62fpz4lh0rz531ajo2t5ef.gz -O OpenCV-4.5.0-aarch64.tar.gz
#8 4.238 

OpenCV-4.5.0-aarch6 100%[===================>]  78.31M  10.2MB/s    in 8.2s    
#8 12.42 + tar -xzvf OpenCV-4.5.0-aarch64.tar.gz
#8 12.43 OpenCV-4.5.0-aarch64-dev.deb
#8 12.46 OpenCV-4.5.0-aarch64-libs.deb
#8 14.19 OpenCV-4.5.0-aarch64-licenses.deb
#8 14.19 OpenCV-4.5.0-aarch64-main.deb
#8 14.19 OpenCV-4.5.0-aarch64-python.deb
#8 14.24 OpenCV-4.5.0-aarch64-scripts.deb
#8 14.24 + dpkg -i --force-depends OpenCV-4.5.0-aarch64-dev.deb OpenCV-4.5.0-aarch64-libs.deb OpenCV-4.5.0-aarch64-licenses.deb OpenCV-4.5.0-aarch64-main.deb OpenCV-4.5.0-aarch64-python.deb OpenCV-4.5.0-aarch64-scripts.deb
#8 14.31 Selecting previously unselected package opencv-dev.
#8 14.37 (Reading database ... 35000 files and directories currently installed.)
#8 14.37 Preparing to unpack OpenCV-4.5.0-aarch64-dev.deb ...
#8 14.38 Unpacking opencv-dev (4.5.0) ...
#8 14.90 Selecting previously unselected package opencv-libs.
#8 14.91 Preparing to unpack OpenCV-4.5.0-aarch64-libs.deb ...
#8 14.92 Unpacking opencv-libs (4.5.0) ...
#8 33.47 Selecting previously unselected package opencv-licenses.
#8 33.48 Preparing to unpack OpenCV-4.5.0-aarch64-licenses.deb ...
#8 33.74 Unpacking opencv-licenses (4.5.0) ...
#8 34.67 Selecting previously unselected package opencv-main.
#8 34.67 Preparing to unpack OpenCV-4.5.0-aarch64-main.deb ...
#8 34.99 Unpacking opencv-main (4.5.0) ...
#8 35.83 Selecting previously unselected package opencv-python.
#8 35.83 Preparing to unpack OpenCV-4.5.0-aarch64-python.deb ...
#8 36.23 Unpacking opencv-python (4.5.0) ...
#8 37.68 Selecting previously unselected package opencv-scripts.
#8 37.69 Preparing to unpack OpenCV-4.5.0-aarch64-scripts.deb ...
#8 37.74 Unpacking opencv-scripts (4.5.0) ...
#8 38.40 Setting up opencv-dev (4.5.0) ...
#8 38.43 Setting up opencv-licenses (4.5.0) ...
#8 38.44 Setting up opencv-main (4.5.0) ...
#8 38.46 Setting up opencv-python (4.5.0) ...
#8 38.48 Setting up opencv-scripts (4.5.0) ...
#8 38.52 Setting up opencv-libs (4.5.0) ...
#8 38.52 dpkg: opencv-libs: dependency problems, but configuring anyway as you requested:
#8 38.52  opencv-libs depends on libatlas3-base; however:
#8 38.52   Package libatlas3-base is not installed.
#8 38.52  opencv-libs depends on libtbb2; however:
#8 38.52   Package libtbb2 is not installed.
#8 38.52  opencv-libs depends on libtesseract4; however:
#8 38.52   Package libtesseract4 is not installed.
#8 38.52 
#8 39.08 Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
#8 39.77 + apt-get update
#8 39.90 Get:1 http://ports.ubuntu.com/ubuntu-ports bionic InRelease [242 kB]
#8 40.12 Get:2 http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease [88.7 kB]
#8 40.16 Get:3 http://ports.ubuntu.com/ubuntu-ports bionic-backports InRelease [83.3 kB]
#8 40.21 Get:4 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease [88.7 kB]
#8 40.41 Get:5 http://ports.ubuntu.com/ubuntu-ports bionic/multiverse arm64 Packages [153 kB]
#8 40.56 Get:6 http://ports.ubuntu.com/ubuntu-ports bionic/restricted arm64 Packages [572 B]
#8 40.56 Get:7 http://ports.ubuntu.com/ubuntu-ports bionic/main arm64 Packages [1285 kB]
#8 40.76 Get:8 http://ports.ubuntu.com/ubuntu-ports bionic/universe arm64 Packages [11.0 MB]
#8 41.72 Get:9 http://ports.ubuntu.com/ubuntu-ports bionic-updates/restricted arm64 Packages [6338 B]
#8 41.72 Get:10 http://ports.ubuntu.com/ubuntu-ports bionic-updates/multiverse arm64 Packages [5349 B]
#8 41.72 Get:11 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main arm64 Packages [2309 kB]
#8 41.98 Get:12 http://ports.ubuntu.com/ubuntu-ports bionic-updates/universe arm64 Packages [2161 kB]
#8 42.35 Get:13 http://ports.ubuntu.com/ubuntu-ports bionic-backports/universe arm64 Packages [20.1 kB]
#8 42.35 Get:14 http://ports.ubuntu.com/ubuntu-ports bionic-backports/main arm64 Packages [64.0 kB]
#8 42.36 Get:15 http://ports.ubuntu.com/ubuntu-ports bionic-security/restricted arm64 Packages [5659 B]
#8 42.36 Get:16 http://ports.ubuntu.com/ubuntu-ports bionic-security/multiverse arm64 Packages [2759 B]
#8 42.36 Get:17 http://ports.ubuntu.com/ubuntu-ports bionic-security/universe arm64 Packages [1469 kB]
#8 42.49 Get:18 http://ports.ubuntu.com/ubuntu-ports bionic-security/main arm64 Packages [1944 kB]
#8 44.74 Fetched 20.9 MB in 5s (4276 kB/s)
#8 44.74 Reading package lists...
#8 47.88 + apt-get install -y -f --no-install-recommends
#8 48.01 Reading package lists...
#8 51.10 Building dependency tree...
#8 51.59 Reading state information...
#8 51.67 Correcting dependencies... Done
#8 52.54 The following additional packages will be installed:
#8 52.54   libatlas3-base libgif7 liblept5 libtbb2 libtesseract4
#8 52.73 The following NEW packages will be installed:
#8 52.73   libatlas3-base libgif7 liblept5 libtbb2 libtesseract4
#8 52.86 0 upgraded, 5 newly installed, 0 to remove and 100 not upgraded.
#8 52.86 Need to get 4067 kB of archives.
#8 52.86 After this operation, 16.4 MB of additional disk space will be used.
#8 52.86 Get:1 http://ports.ubuntu.com/ubuntu-ports bionic/universe arm64 libatlas3-base arm64 3.10.3-5 [2097 kB]
#8 53.22 Get:2 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main arm64 libgif7 arm64 5.1.4-2ubuntu0.1 [29.3 kB]
#8 53.24 Get:3 http://ports.ubuntu.com/ubuntu-ports bionic/universe arm64 liblept5 arm64 1.75.3-3 [775 kB]
#8 53.31 Get:4 http://ports.ubuntu.com/ubuntu-ports bionic/universe arm64 libtesseract4 arm64 4.00~git2288-10f4998a-2 [1078 kB]
#8 53.40 Get:5 http://ports.ubuntu.com/ubuntu-ports bionic/universe arm64 libtbb2 arm64 2017~U7-8 [87.8 kB]
#8 54.11 debconf: delaying package configuration, since apt-utils is not installed
#8 54.47 Fetched 4067 kB in 1s (6480 kB/s)
#8 54.54 Selecting previously unselected package libatlas3-base:arm64.
#8 54.54 (Reading database ... 
[...]
(Reading database ... 100%
(Reading database ... 35937 files and directories currently installed.)
#8 54.59 Preparing to unpack .../libatlas3-base_3.10.3-5_arm64.deb ...
#8 54.61 Unpacking libatlas3-base:arm64 (3.10.3-5) ...
#8 55.30 Selecting previously unselected package libgif7:arm64.
#8 55.31 Preparing to unpack .../libgif7_5.1.4-2ubuntu0.1_arm64.deb ...
#8 55.32 Unpacking libgif7:arm64 (5.1.4-2ubuntu0.1) ...
#8 55.43 Selecting previously unselected package liblept5.
#8 55.43 Preparing to unpack .../liblept5_1.75.3-3_arm64.deb ...
#8 55.45 Unpacking liblept5 (1.75.3-3) ...
#8 55.73 Selecting previously unselected package libtesseract4.
#8 55.74 Preparing to unpack .../libtesseract4_4.00~git2288-10f4998a-2_arm64.deb ...
#8 55.75 Unpacking libtesseract4 (4.00~git2288-10f4998a-2) ...
#8 56.12 Selecting previously unselected package libtbb2:arm64.
#8 56.12 Preparing to unpack .../libtbb2_2017~U7-8_arm64.deb ...
#8 56.13 Unpacking libtbb2:arm64 (2017~U7-8) ...
#8 56.29 Setting up libatlas3-base:arm64 (3.10.3-5) ...
#8 56.32 update-alternatives: using /usr/lib/aarch64-linux-gnu/atlas/libblas.so.3 to provide /usr/lib/aarch64-linux-gnu/libblas.so.3 (libblas.so.3-aarch64-linux-gnu) in auto mode
#8 56.32 update-alternatives: using /usr/lib/aarch64-linux-gnu/atlas/liblapack.so.3 to provide /usr/lib/aarch64-linux-gnu/liblapack.so.3 (liblapack.so.3-aarch64-linux-gnu) in auto mode
#8 56.33 Setting up libtbb2:arm64 (2017~U7-8) ...
#8 56.35 Setting up libgif7:arm64 (5.1.4-2ubuntu0.1) ...
#8 56.37 Setting up liblept5 (1.75.3-3) ...
#8 56.38 Setting up libtesseract4 (4.00~git2288-10f4998a-2) ...
#8 56.40 Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
#8 56.54 + dpkg -i OpenCV-4.5.0-aarch64-dev.deb OpenCV-4.5.0-aarch64-libs.deb OpenCV-4.5.0-aarch64-licenses.deb OpenCV-4.5.0-aarch64-main.deb OpenCV-4.5.0-aarch64-python.deb OpenCV-4.5.0-aarch64-scripts.deb
#8 56.64 (Reading database ... 36011 files and directories currently installed.)
#8 56.65 Preparing to unpack OpenCV-4.5.0-aarch64-dev.deb ...
#8 56.67 Unpacking opencv-dev (4.5.0) over (4.5.0) ...
#8 57.22 Preparing to unpack OpenCV-4.5.0-aarch64-libs.deb ...
#8 57.24 Unpacking opencv-libs (4.5.0) over (4.5.0) ...
#8 71.28 Preparing to unpack OpenCV-4.5.0-aarch64-licenses.deb ...
#8 71.30 Unpacking opencv-licenses (4.5.0) over (4.5.0) ...
#8 72.56 Preparing to unpack OpenCV-4.5.0-aarch64-main.deb ...
#8 72.62 Unpacking opencv-main (4.5.0) over (4.5.0) ...
#8 73.61 Preparing to unpack OpenCV-4.5.0-aarch64-python.deb ...
#8 73.84 Unpacking opencv-python (4.5.0) over (4.5.0) ...
#8 76.34 Preparing to unpack OpenCV-4.5.0-aarch64-scripts.deb ...
#8 76.36 Unpacking opencv-scripts (4.5.0) over (4.5.0) ...
#8 77.04 Setting up opencv-dev (4.5.0) ...
#8 77.05 Setting up opencv-libs (4.5.0) ...
#8 77.45 Setting up opencv-licenses (4.5.0) ...
#8 77.46 Setting up opencv-main (4.5.0) ...
#8 77.48 Setting up opencv-python (4.5.0) ...
#8 77.50 Setting up opencv-scripts (4.5.0) ...
#8 77.52 Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
#8 78.33 + rm -rf /var/lib/apt/lists/auxfiles /var/lib/apt/lists/lock /var/lib/apt/lists/partial /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic-backports_InRelease /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic-backports_main_binary-arm64_Packages.lz4 /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic-backports_universe_binary-arm64_Packages.lz4 /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic-security_InRelease /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic-security_main_binary-arm64_Packages.lz4 /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic-security_multiverse_binary-arm64_Packages.lz4 /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic-security_restricted_binary-arm64_Packages.lz4 /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic-security_universe_binary-arm64_Packages.lz4 /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic-updates_InRelease /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic-updates_main_binary-arm64_Packages.lz4 /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic-updates_multiverse_binary-arm64_Packages.lz4 /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic-updates_restricted_binary-arm64_Packages.lz4 /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic-updates_universe_binary-arm64_Packages.lz4 /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic_InRelease /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic_main_binary-arm64_Packages.lz4 /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic_multiverse_binary-arm64_Packages.lz4 /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic_restricted_binary-arm64_Packages.lz4 /var/lib/apt/lists/ports.ubuntu.com_ubuntu-ports_dists_bionic_universe_binary-arm64_Packages.lz4
#8 78.36 + apt-get clean
#8 78.37 + cd ../
#8 78.37 + rm -rf opencv
#8 78.46 ++ python3 -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}".format(*version))'
#8 78.51 + PYTHON3_VERSION=3.6
#8 78.51 + '[' aarch64 = aarch64 ']'
#8 78.51 + local_include_path=/usr/local/include/opencv4
#8 78.51 + local_python_path=/usr/local/lib/python3.6/dist-packages/cv2
#8 78.51 + '[' -d /usr/local/include/opencv4 ']'
#8 78.52 + '[' -d /usr/local/lib/python3.6/dist-packages/cv2 ']'
#8 78.52 + ln -s /usr/include/opencv4 /usr/local/include/opencv4
#8 78.54 + ln -s /usr/lib/python3.6/dist-packages/cv2 /usr/local/lib/python3.6/dist-packages/cv2
#8 78.54 testing cv2 module under python...
#8 78.54 + echo 'testing cv2 module under python...'
#8 78.54 + python3 -c 'import cv2; print('\''OpenCV version:'\'', str(cv2.__version__)); print(cv2.getBuildInformation())'
#8 79.12 Traceback (most recent call last):
#8 79.12   File "<string>", line 1, in <module>
#8 79.12   File "/usr/local/lib/python3.6/dist-packages/cv2/__init__.py", line 96, in <module>
#8 79.12     bootstrap()
#8 79.12   File "/usr/local/lib/python3.6/dist-packages/cv2/__init__.py", line 86, in bootstrap
#8 79.12     import cv2
#8 79.12 ImportError: libcublas.so.10: cannot open shared object file: No such file or directory
#8 ERROR: process "/bin/sh -c cd /opt && ./opencv_install.sh" did not complete successfully: exit code: 1
------
 > [4/4] RUN cd /opt && ./opencv_install.sh:
#8 78.54 testing cv2 module under python...
#8 78.54 + echo 'testing cv2 module under python...'
#8 78.54 + python3 -c 'import cv2; print('\''OpenCV version:'\'', str(cv2.__version__)); print(cv2.getBuildInformation())'
#8 79.12 Traceback (most recent call last):
#8 79.12   File "<string>", line 1, in <module>
#8 79.12   File "/usr/local/lib/python3.6/dist-packages/cv2/__init__.py", line 96, in <module>
#8 79.12     bootstrap()
#8 79.12   File "/usr/local/lib/python3.6/dist-packages/cv2/__init__.py", line 86, in bootstrap
#8 79.12     import cv2
#8 79.12 ImportError: libcublas.so.10: cannot open shared object file: No such file or directory
------
Dockerfile:25
--------------------
  23 |         cat opencv_install.sh
  24 |     
  25 | >>> RUN cd /opt && ./opencv_install.sh
  26 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c cd /opt && ./opencv_install.sh" did not complete successfully: exit code: 1

Is it not possible to build ROS Iron on Jetson Nano or am I doing something wrong?

dusty-nv commented 10 months ago

Hi @michael-schaefer-eu, have you set your default-docker runtime to nvidia like here?

https://github.com/dusty-nv/jetson-containers/blob/master/docs/setup.md#docker-default-runtime

Do you have CUDA Toolkit installed on your device, outside container? You should find that libcublas.so.10 file under /usr/local/cuda/lib64/libcublas ? On JetPack 4, CUDA/cuDNN/TensorRT are mounted from the host device.

Are you able to run pre-built l4t-pytorch container and import torch ? If not, the nvidia container runtime isn't working properly.

michael-schaefer-eu commented 10 months ago

Hi @dusty-nv , thank you very much for your help.

Yes, docker runtime is set to nvidia:

sudo docker info | grep 'Default Runtime'
Default Runtime: nvidia

Cuda Toolkit is installed on the host:

ls -hal /usr/local/cuda/lib64/ | grep libcublas
lrwxrwxrwx 1 root root   17 Mar  1  2021 libcublasLt.so -> libcublasLt.so.10
lrwxrwxrwx 1 root root   25 Mar  1  2021 libcublasLt.so.10 -> libcublasLt.so.10.2.3.300
-rw-r--r-- 1 root root  33M Mar  1  2021 libcublasLt.so.10.2.3.300
-rw-r--r-- 1 root root  35M Mar  1  2021 libcublasLt_static.a
lrwxrwxrwx 1 root root   15 Mar  1  2021 libcublas.so -> libcublas.so.10
lrwxrwxrwx 1 root root   23 Mar  1  2021 libcublas.so.10 -> libcublas.so.10.2.3.300
-rw-r--r-- 1 root root  78M Mar  1  2021 libcublas.so.10.2.3.300
-rw-r--r-- 1 root root  93M Mar  1  2021 libcublas_static.a

Also OpenCV (if that matters):

python3 -c "import cv2; print('OpenCV version:', str(cv2.__version__));"
OpenCV version: 4.1.1

I will try out the torch container as soon as possible, I guess it's that one: dustynv/pytorch:1.10-r32.7.1

If the nvidia container runtime isn't working properly, can I fix that or do I have to reinstall the complete OS again?

michael-schaefer-eu commented 10 months ago

Also /usr/local/cuda/include/ contains no cudnn headers, but I found it in /usr/include/cudnn.h .

Is it possible that it has not been installed properly when I upgraded the system from L4T 32.5 to 32.7 ? Or is that OK that way?

Is there a script available to check all the required libs on the host? I couldn't find out anything.

dusty-nv commented 10 months ago

If the container mounts aren't working on JetPack 4, typically I just reflash the system because they are tricky to debug/fix

michael-schaefer-eu commented 10 months ago

thanks @dusty-nv ,

I re-flashed my jetson nano with the latest Jetpack 4.6.4 with L4T 32.7.4 (via the Docker SDK Manager, that alone took me a while to get it running ... )

The build process still failed with the same error as above, but this time at least the run worked for me:

./run.sh dustynv/l4t-pytorch:r32.7.1

and

./run.sh dustynv/ros:iron-ros-base-l4t-r32.7.1

and both can load CV2 inside the container :

root@jbot:/# python3 -c "import cv2; print('OpenCV version:', str(cv2.__version__));"
OpenCV version: 4.5.0