Nvidia Jetson Orin Nano Developer Kit : Vision Transfomer: NanoSAM and Computer Vision : Unable to Install nanosam

Unable to run Nvidia Nano SAM on Nvidia Jetson Orin Nano Developer Kit.

jetson-containers run $(autotag nanosam) results in the below error


[02/11/2025-11:18:23] [I] Start parsing network model.
[02/11/2025-11:18:23] [I] [TRT] ----------------------------------------------------------------
[02/11/2025-11:18:23] [I] [TRT] Input filename:   data/mobile_sam_mask_decoder.onnx
[02/11/2025-11:18:23] [I] [TRT] ONNX IR version:  0.0.8
[02/11/2025-11:18:23] [I] [TRT] Opset version:    16
[02/11/2025-11:18:23] [I] [TRT] Producer name:    pytorch
[02/11/2025-11:18:23] [I] [TRT] Producer version: 1.14.0
[02/11/2025-11:18:23] [I] [TRT] Domain:           
[02/11/2025-11:18:23] [I] [TRT] Model version:    0
[02/11/2025-11:18:23] [I] [TRT] Doc string:       
[02/11/2025-11:18:23] [I] [TRT] ----------------------------------------------------------------
[02/11/2025-11:18:23] [I] Finished parsing network model. Parse time: 0.0953568
[02/11/2025-11:18:23] [I] Set shape of input tensor point_coords for optimization profile 0 to: MIN=1x1x2 OPT=1x1x2 MAX=1x10x2
[02/11/2025-11:18:23] [I] Set shape of input tensor point_labels for optimization profile 0 to: MIN=1x1 OPT=1x1 MAX=1x10
[02/11/2025-11:18:23] [W] [TRT] DLA requests all profiles have same min, max, and opt value. All dla layers are falling back to GPU
[02/11/2025-11:18:23] [I] [TRT] Local timing cache in use. Profiling results in this builder pass will not be stored.
[02/11/2025-11:18:24] [I] [TRT] Compiler backend is used during engine build.
[02/11/2025-11:18:42] [W] [TRT] Tactic Device request: 56MB Available: 11MB. Device memory is insufficient to use tactic.
[02/11/2025-11:18:42] [W] [TRT] UNSUPPORTED_STATE: Skipping tactic 0 due to insufficient memory on requested size of 58933760 detected for tactic 0x0000000000000000.
[02/11/2025-11:18:42] [E] Error[10]: IBuilder::buildSerializedNetwork: Error Code 10: Internal Error (Could not find any implementation for node {ForeignNode[model.prompt_encoder.pe_layer.positional_encoding_gaussian_matrix.../Transpose + /Reshape_3]}.)
[02/11/2025-11:18:42] [E] Engine could not be created from network
[02/11/2025-11:18:42] [E] Building engine failed
[02/11/2025-11:18:42] [E] Failed to create engine from model or file.
[02/11/2025-11:18:42] [E] Engine set up failed
&&&& FAILED TensorRT.trtexec [TensorRT v100400] [b26] # /usr/src/tensorrt/bin/trtexec --onnx=data/mobile_sam_mask_decoder.onnx --saveEngine=data/mobile_sam_mask_decoder.engine --minShapes=point_coords:1x1x2,point_labels:1x1 --optShapes=point_coords:1x1x2,point_labels:1x1 --maxShapes=point_coords:1x10x2,point_labels:1x10
The command '/bin/sh -c cd /opt/nanosam &&     /usr/src/tensorrt/bin/trtexec         --onnx=data/mobile_sam_mask_decoder.onnx         --saveEngine=data/mobile_sam_mask_decoder.engine         --minShapes=point_coords:1x1x2,point_labels:1x1         --optShapes=point_coords:1x1x2,point_labels:1x1         --maxShapes=point_coords:1x10x2,point_labels:1x10' returned a non-zero code: 1
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/nataraj/aidata/jetson-containers/jetson_containers/tag.py", line 58, in <module>
    image = find_container(args.packages[0], prefer_sources=args.prefer, disable_sources=args.disable, user=args.user, quiet=args.quiet)
  File "/home/nataraj/aidata/jetson-containers/jetson_containers/container.py", line 537, in find_container
    return build_container('', package) #, simulate=True)
  File "/home/nataraj/aidata/jetson-containers/jetson_containers/container.py", line 147, in build_container
    status = subprocess.run(cmd.replace(_NEWLINE_, ' '), executable='/bin/bash', shell=True, check=True)  
  File "/usr/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'DOCKER_BUILDKIT=0 docker build --network=host --tag nanosam:r36.4.3-nanosam --file /home/nataraj/aidata/jetson-containers/packages/vit/nanosam/Dockerfile --build-arg BASE_IMAGE=nanosam:r36.4.3-transformers /home/nataraj/aidata/jetson-containers/packages/vit/nanosam 2>&1 | tee /home/nataraj/aidata/jetson-containers/logs/20250211_163926/build/nanosam_r36.4.3-nanosam.txt; exit ${PIPESTATUS[0]}' returned non-zero exit status 1.
-- Error:  return code 1
V4L2_DEVICES:  --device /dev/video0  --device /dev/video1 
+ docker run --runtime nvidia -it --rm --network host --shm-size=8g --volume /tmp/argus_socket:/tmp/argus_socket --volume /etc/enctune.conf:/etc/enctune.conf --volume /etc/nv_tegra_release:/etc/nv_tegra_release --volume /tmp/nv_jetson_model:/tmp/nv_jetson_model --volume /var/run/dbus:/var/run/dbus --volume /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket --volume /var/run/docker.sock:/var/run/docker.sock --volume /home/nataraj/aidata/data:/data -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro --device /dev/snd -e PULSE_SERVER=unix:/run/user/1000/pulse/native -v /run/user/1000/pulse:/run/user/1000/pulse --device /dev/bus/usb --device /dev/video0 --device /dev/video1 --device /dev/i2c-0 --device /dev/i2c-1 --device /dev/i2c-2 --device /dev/i2c-4 --device /dev/i2c-5 --device /dev/i2c-7 --device /dev/i2c-9 --name jetson_container_20250211_164843
"docker run" requires at least 1 argument.
See 'docker run --help'.

Usage:  docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Create and run a new container from an image


when trying to build it i am getting the below error

jetson-containers build nanosam

but Gdown can't. Please check connections and permissions.
The command '/bin/sh -c pip3 install gdown &&     cd /opt/nanosam/data/ &&     gdown https://drive.google.com/uc?id=14-SsvoaTl-esC3JOzomHDnI9OGgdO2OR &&     ls -lh &&     cd /opt/nanosam/ &&     /usr/src/tensorrt/bin/trtexec         --onnx=data/resnet18_image_encoder.onnx         --saveEngine=data/resnet18_image_encoder.engine         --fp16' returned a non-zero code: 1

Tried downloading the file manually but could not

Detailed log below

 Downloading https://pypi.jetson-ai-lab.dev/root/pypi/%2Bf/e72/c4ff06e4fb6e4/soupsieve-2.6-py3-none-any.whl (36 kB)
Requirement already satisfied: typing-extensions>=4.0.0 in /usr/local/lib/python3.10/dist-packages (from beautifulsoup4->gdown) (4.12.2)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests[socks]->gdown) (3.4.1)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests[socks]->gdown) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests[socks]->gdown) (2.3.0)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests[socks]->gdown) (2025.1.31)
qCollecting PySocks!=1.5.7,>=1.5.6 (from requests[socks]->gdown)
  Downloading https://pypi.jetson-ai-lab.dev/root/pypi/%2Bf/272/5bd0a9925919b/PySocks-1.7.1-py3-none-any.whl (16 kB)
Installing collected packages: soupsieve, PySocks, beautifulsoup4, gdown
Successfully installed PySocks-1.7.1 beautifulsoup4-4.13.3 gdown-5.2.0 soupsieve-2.6
Failed to retrieve file url:

	Cannot retrieve the public link of the file. You may need to change
	the permission to 'Anyone with the link', or have had many accesses.
	Check FAQ in https://github.com/wkentaro/gdown?tab=readme-ov-file#faq.

You may still be able to access the file from the browser:

	https://drive.google.com/uc?id=14-SsvoaTl-esC3JOzomHDnI9OGgdO2OR

but Gdown can't. Please check connections and permissions.
The command '/bin/sh -c pip3 install gdown &&     cd /opt/nanosam/data/ &&     gdown https://drive.google.com/uc?id=14-SsvoaTl-esC3JOzomHDnI9OGgdO2OR &&     ls -lh &&     cd /opt/nanosam/ &&     /usr/src/tensorrt/bin/trtexec         --onnx=data/resnet18_image_encoder.onnx         --saveEngine=data/resnet18_image_encoder.engine         --fp16' returned a non-zero code: 1
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/nataraj/aidata/jetson-containers/jetson_containers/build.py", line 122, in <module>
    build_container(args.name, args.packages, args.base, args.build_flags, args.build_args, args.simulate, args.skip_tests, args.test_only, args.push, args.no_github_api, args.skip_packages)
  File "/home/nataraj/aidata/jetson-containers/jetson_containers/container.py", line 147, in build_container
    status = subprocess.run(cmd.replace(_NEWLINE_, ' '), executable='/bin/bash', shell=True, check=True)  
  File "/usr/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'DOCKER_BUILDKIT=0 docker build --network=host --tag nanosam:r36.4.3-nanosam --file /home/nataraj/aidata/jetson-containers/packages/vit/nanosam/Dockerfile --build-arg BASE_IMAGE=nanosam:r36.4.3-transformers /home/nataraj/aidata/jetson-containers/packages/vit/nanosam 2>&1 | tee /home/nataraj/aidata/jetson-containers/logs/20250211_165927/build/nanosam_r36.4.3-nanosam.txt; exit ${PIPESTATUS[0]}' returned non-zero exit status 1.

Uploaded the log file here jetson-containers -nanosam.txt (169.1 KB)

Your previous issue are on Orin Nano, but now are on Jetson Nano.
Are you using Jetson Nano or Orin Nano devkit?

i am using Jetson Orin Nano Developer Kit

Moving over to Orin Nano forum.

Hi,

Failed to retrieve file url:

	Cannot retrieve the public link of the file. You may need to change
	the permission to 'Anyone with the link', or have had many accesses.
	Check FAQ in https://github.com/wkentaro/gdown?tab=readme-ov-file#faq.

You may still be able to access the file from the browser:

	https://drive.google.com/uc?id=14-SsvoaTl-esC3JOzomHDnI9OGgdO2OR

The file can be found in the link below:
https://github.com/NVIDIA-AI-IOT/nanosam/?tab=readme-ov-file#%EF%B8%8F-setup

  1. Build the TensorRT engine for the mask decoder
    i. Export the MobileSAM mask decoder ONNX file (or download directly from here)

Could you give it a try or modify the download link correspondingly:

Thanks.

Updated the link as per the the document in the git

I was not able to download this file manually and because was not able to download the right file it failed again

Reason why i could not download the file

error,.login,.request-storage-access{display:none}.error,.login,.request-storage-access,.too-many-login-redirects{margin:auto;padding:36px}.document-root.show-error .error,.document-root.show-login-page .login,.document-root.show-storage-access .request-storage-access,.too-many-login-redirects

Because it could not download the model file (14-SsvoaTl-esC3JOzomHDnI9OGgdO2OR)the build failed again

Installing collected packages: soupsieve, PySocks, beautifulsoup4, gdown
Successfully installed PySocks-1.7.1 beautifulsoup4-4.13.3 gdown-5.2.0 soupsieve-2.6
/usr/local/lib/python3.10/dist-packages/gdown/parse_url.py:48: UserWarning: You specified a Google Drive link that is not the correct link to download a file. You might want to try `--fuzzy` option or the following url: https://drive.google.com/uc?id=None
  warnings.warn(
Downloading...
From: https://drive.google.com/file/d/14-SsvoaTl-esC3JOzomHDnI9OGgdO2OR
To: /opt/nanosam/data/14-SsvoaTl-esC3JOzomHDnI9OGgdO2OR
8.92kB [00:00, 615kB/s]
total 34M
-rw-r--r-- 1 root root 8.8K Feb 12 06:22 14-SsvoaTl-esC3JOzomHDnI9OGgdO2OR
-rw-r--r-- 1 root root  19M Feb 11 11:31 mobile_sam_mask_decoder.engine
-rw-r--r-- 1 root root  16M Feb 11 11:18 mobile_sam_mask_decoder.onnx
&&&& RUNNING TensorRT.trtexec [TensorRT v100400] [b26] # /usr/src/tensorrt/bin/trtexec --onnx=data/resnet18_image_encoder.onnx --saveEngine=data/resnet18_image_encoder.engine --fp16

Is this still an issue to support? Any result can be shared?

The file is still not accessible

gdown https://drive.google.com/uc?id=14-SsvoaTl-esC3JOzomHDnI9OGgdO2OR
Failed to retrieve file url:

	Cannot retrieve the public link of the file. You may need to change
	the permission to 'Anyone with the link', or have had many accesses.
	Check FAQ in https://github.com/wkentaro/gdown?tab=readme-ov-file#faq.

You may still be able to access the file from the browser:

	https://drive.google.com/uc?id=14-SsvoaTl-esC3JOzomHDnI9OGgdO2OR

but Gdown can't. Please check connections and permissions.

Hi,

You can find the file in the below link:

Thanks.