Jetson container package torch2trt on nano orin 8gb Developement kit

Hi,

I have a jetson orin nano 8gb development kit. When I try to build a container using jetson_containers. I want to include several packages in the container.

– L4T_VERSION=35.4.1
– JETPACK_VERSION=5.1.2
– CUDA_VERSION=11.4.315
– LSB_RELEASE=20.04 (focal)

I run the command

./build.sh --name=arsd ros:foxy-desktop realsense pytorch l4t-pytorch cuda-python opencv

and I am getting the following error:

.
.
.

sourcing   /opt/ros/foxy/install/setup.bash
ROS_DISTRO foxy
ROS_ROOT   /opt/ros/foxy
testing torchaudio...
torchaudio version: 2.0.1+3b40834
found audio backend 'sox_io' OK
found audio backend 'soundfile' OK
torchaudio OK

-- Building container arsd:r35.4.1-torch2trt

docker build --network=host --tag arsd:r35.4.1-torch2trt \
--file /home/omar/jetson-containers/packages/pytorch/torch2trt/Dockerfile \
--build-arg BASE_IMAGE=arsd:r35.4.1-torchaudio \
--build-arg CUDA_ARCHITECTURES="72;87" \
/home/omar/jetson-containers/packages/pytorch/torch2trt \
2>&1 | tee /home/omar/jetson-containers/logs/20230906_175907/build/arsd_r35.4.1-torch2trt.txt; exit ${PIPESTATUS[0]}

DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            Install the buildx component to build images with BuildKit:
            https://docs.docker.com/go/buildx/

Sending build context to Docker daemon  12.29kB
Step 1/5 : ARG BASE_IMAGE
Step 2/5 : FROM ${BASE_IMAGE}
 ---> 609527e96ea4
Step 3/5 : ARG CUDA_ARCHITECTURES
 ---> Using cache
 ---> b381ce7940be
Step 4/5 : RUN cd /opt &&     git clone --depth=1 https://github.com/NVIDIA-AI-IOT/torch2trt &&     cd torch2trt &&     pip3 install --verbose . &&     sed 's|^set(CUDA_ARCHITECTURES.*|#|g' -i CMakeLists.txt &&     cmake -B build -DCUDA_ARCHITECTURES=${CUDA_ARCHITECTURES} . &&     cmake --build build --target install &&     ldconfig
 ---> Running in 98dea35b1daf
Cloning into 'torch2trt'...
Using pip 23.2.1 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8)
Processing /opt/torch2trt
  Preparing metadata (setup.py): started
  Running command python setup.py egg_info
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/opt/torch2trt/setup.py", line 2, in <module>
      import tensorrt
    File "/usr/lib/python3.8/dist-packages/tensorrt/__init__.py", line 68, in <module>
      from .tensorrt import *
  ImportError: libnvdla_compiler.so: cannot open shared object file: No such file or directory
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /usr/bin/python3 -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize
  
  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)
  
  __file__ = %r
  sys.argv[0] = __file__
  
  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"
  
  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'/opt/torch2trt/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' egg_info --egg-base /tmp/pip-pip-egg-info-skhimh29
  cwd: /opt/torch2trt/
  Preparing metadata (setup.py): finished with status 'error'
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
The command '/bin/bash -c cd /opt &&     git clone --depth=1 https://github.com/NVIDIA-AI-IOT/torch2trt &&     cd torch2trt &&     pip3 install --verbose . &&     sed 's|^set(CUDA_ARCHITECTURES.*|#|g' -i CMakeLists.txt &&     cmake -B build -DCUDA_ARCHITECTURES=${CUDA_ARCHITECTURES} . &&     cmake --build build --target install &&     ldconfig' returned a non-zero code: 1
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/omar/jetson-containers/jetson_containers/build.py", line 93, in <module>
    build_container(args.name, args.packages, args.base, args.build_flags, args.simulate, args.skip_tests, args.push)
  File "/home/omar/jetson-containers/jetson_containers/container.py", line 119, in build_container
    status = subprocess.run(cmd.replace(_NEWLINE_, ' '), executable='/bin/bash', shell=True, check=True)  
  File "/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'docker build --network=host --tag arsd:r35.4.1-torch2trt --file /home/omar/jetson-containers/packages/pytorch/torch2trt/Dockerfile --build-arg BASE_IMAGE=arsd:r35.4.1-torchaudio --build-arg CUDA_ARCHITECTURES="72;87" /home/omar/jetson-containers/packages/pytorch/torch2trt 2>&1 | tee /home/omar/jetson-containers/logs/20230906_175907/build/arsd_r35.4.1-torch2trt.txt; exit ${PIPESTATUS[0]}' returned non-zero exit status 1.

I can find the file under /usr/lib/aarch64-linux-gnu/tegra/libnvdla_compiler.so

Additionally, I was wondering if it is possible to install buildx plugin on the jetson orin nano.

Thanks in advance :)

Hi @o.zayed, have you set your default docker runtime to nvidia like in the setup guide?

I had problems with buildkit in the past, with it not using the nvidia runtime during builds.

Also, see this recent post (it seems that the ordering of ROS/PyTorch in the package list matters)

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