No CUDA runtime is found, using CUDA_HOME=‘/usr/local/cuda’


Previously, I create Python virtual environment in my Jetson Orin Nano (my CUDA version is 11.4.315) by using torch = 2.1.0a0+41361538.nv23.06 and torchvision = 0.16.0+fbb4cc5. It can work well without any error both installation process and inference. After that try to do the same thing with docker, I pulled the l4t-tensorrt My docker image is built successfully and torch.cuda.is_available() returned True after I installed torch, but when I installed torchvision I got this error: No CUDA runtime is found, using CUDA_HOME=‘/usr/local/cuda’


This is my code inside bash script to install torchvision:

 sudo apt install -y libjpeg-dev zlib1g-dev
 git clone torchvision
 cd /home/torch/torchvision
 git checkout v0.16.0
 python3 install --user

This is my DockerFile:

# Use NVIDIA L4T TensorRT image as the base

# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive

# Set CUDA paths
ENV CUDA_HOME=/usr/local/cuda
ENV PATH=/usr/local/cuda/bin:${PATH}
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH}

# Set the working directory in the container
WORKDIR /usr/src/app

# Copy the Python script into the container
COPY /usr/src/app/

RUN chmod +x /usr/src/app/ && /bin/bash /usr/src/app/

I guess my problem is CUDA paths setting …
How can I set the correct CUDA paths or do you have a complete DockerFile to setup and install torchvision with ?