Cannot install torchvision inside Isaac ROS container, cusparse.h not found

I downloaded the Isaac ROS docker image on my Orin Nano, and I want to install the package YOLOv5-with-Isaac-ROS, for that I need to first install torchvision. I tried to do that by following the instructions from here for pytorch 1.12 and torchvision 0.13.0, but it fails with the error:

In file included from /workspaces/isaac_ros-dev/torchvision/torchvision/csrc/ops/cuda/deform_conv2d_kernel.cu:70:
/usr/local/lib/python3.8/dist-packages/torch/include/ATen/cuda/CUDAContext.h:6:10: fatal error: cusparse.h: No such file or directory
    6 | #include <cusparse.h>
      |          ^~~~~~~~~~~~
compilation terminated.
error: command '/usr/local/cuda/bin/nvcc' failed with exit code 1

The file does exist outside the container, and also the file libcusparse.so.11 is mounted in the container.
First I tried to mount the CUDA directory when I run the docker container, but that gave a bunch of other errors so I don’t think that is the right way.
Then I tried sudo apt-get install libcusparse-dev-11-4, but that threw an error Invalid cross-device link.
Anyone has any idea what else I can try?

Thank you in advance

  • Edit: tried to install with python3 -m pip install torchvision==0.13.0 and looks like it worked but when I import torchvision I get
UserWarning: Failed to load image Python extension: 
  warn(f"Failed to load image Python extension: {e}")

I tried to google it but didn’t find much, is that warning problematic? because when I try launching the YOLOv5 node together with the realsense camera node, I don’t see an image in the GUI that is opened, so I wonder if it has anything to do with that warning

You’ll need to build torchvision from source in order to link against the right libraries as compiled with the NVIDIA-compiled build of pytorch as described by an Isaac ROS user here.

libcusparse.so.11 is only the runtime binary, looks like this needs the development package.

Sorry for the delayed response. I tried installing torchvision from source (as described here, both v0.13.0 and 0.14.0 failed with the same error I described above, cusparse.h: No such file or directory. How can I get those headers inside the container? I tried installing both libcusparse-11-4 and libcusparse-dev-11-4 but the installation fails.

Could you try with an older version of the pytorch as listed over here.

Try sudo apt install nvidia-cuda-dev in the host system