AssertionError: Torch not compiled with CUDA enabled

I know the solution for this error is here: AssertionError: Torch not compiled with CUDA enabled and also here too: Torch not compiled with cuda enabled over Jetson Xavier Nx

I think, I have the correct software stacks according to those solutions or I have whatever software stacks are compatible with each other. Still, I am getting the same error : AssertionError: Torch not compiled with CUDA-enabled

I have following

Jetpack :
Package: nvidia-jetpack
Version: 6.0-b52

Cuda :
CUDA Version: 12.2

PyTorch :
2.1.2

TensorRT version: 8.6.2

For the following script

import torch

print(torch.cuda.is_available())

I got False

Note: I have installed all the software stack from the SDK manager on my jetson orin nano.

can anyone help me with what is wrong? I appreciate any help anyone can provide.

Hi @sarodeanil35, did you install one of the PyTorch wheels from this topic that was built with CUDA enabled?

My guess is not, since your PyTorch version is 2.1.2, and we haven’t released a PyTorch wheel for JetPack 6 with that specific version.

@dusty_nv

So here I form the following commands :
`wget https://nvidia.box.com/shared/static/p57jwntv436lfrd78inwl7iml6p13fzh.whl -O torch-2.2.0a0+6a974be.nv23.11-cp310-cp310-linux_aarch64.whl

sudo apt-get install python3-pip libopenblas-base libopenmpi-dev libomp-dev

pip3 install Cython<3

pip3 install numpy torch-2.2.0a0+6a974be.nv23.11-cp310-cp310-linux_aarch64.whl`

To install PyTorch version 2.2.0

But then I am getting the following

`sudo apt-get install python3-pip libopenblas-base libopenmpi-dev libomp-dev
pip3 install Cython<3
pip3 install numpy torch-2.2.0a0+6a974be.nv23.11-cp310-cp310-linux_aarch64.whl
[sudo] password for t-tech:

Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
libomp-dev is already the newest version (1:14.0-55~exp2).
libopenblas-base is already the newest version (0.3.20+ds-1).
libopenmpi-dev is already the newest version (4.1.2-2ubuntu1).
python3-pip is already the newest version (22.0.2+dfsg-1ubuntu0.4).
The following packages were automatically installed and are no longer required:
gdal-data libaec0 libarmadillo10 libarpack2 libavcodec-dev libavformat-dev libavutil-dev libblosc1 libcfitsio9 libcharls2 libdc1394-dev libdeflate-dev libdouble-conversion3
libexif-dev libfreexl1 libfyba0 libgdal30 libgdcm-dev libgdcm3.0 libgeos-c1v5 libgeos3.10.2 libgeotiff5 libgl2ps1.4 libglew2.2 libgphoto2-dev libhdf4-0-alt libhdf5-103-1
libhdf5-hl-100 libheif1 libilmbase-dev libjbig-dev libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev libkmlbase1 libkmldom1 libkmlengine1 liblept5 libminizip1 libmysqlclient21
libnetcdf19 libodbc2 libodbcinst2 libogdi4.1 libopencv-calib3d4.5d libopencv-contrib4.5d libopencv-dnn4.5d libopencv-features2d4.5d libopencv-flann4.5d libopencv-highgui4.5d
libopencv-imgcodecs4.5d libopencv-imgproc4.5d libopencv-ml4.5d libopencv-objdetect4.5d libopencv-photo4.5d libopencv-shape4.5d libopencv-stitching4.5d libopencv-superres4.5d
libopencv-video4.5d libopencv-videoio4.5d libopencv-videostab4.5d libopencv-viz4.5d libopenexr-dev libpng-dev libpq5 libproj22 libraw1394-dev librttopo1 libsocket++1
libspatialite7 libsuperlu5 libswresample-dev libswscale-dev libsz2 libtbb-dev libtesseract4 libtiff-dev libtiffxx5 liburiparser1 libvtk9.1 libxerces-c3.2 mysql-common proj-data
unixodbc-common
Use ‘sudo apt autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
-bash: 3: No such file or directory
Defaulting to user installation because normal site-packages is not writeable
Processing ./torch-2.2.0a0+6a974be.nv23.11-cp310-cp310-linux_aarch64.whl
Requirement already satisfied: numpy in ./.local/lib/python3.10/site-packages (1.26.2)
Requirement already satisfied: typing-extensions in ./.local/lib/python3.10/site-packages (from torch==2.2.0a0+6a974be.nv23.11) (4.9.0)
Installing collected packages: torch
Successfully installed torch-1.8.0

Why it is installing the wrong version?

I understand why it is installing the wrong version. The URL is for 1.8.0, but where can I find the correct URL to Substitute the URL?

Unfortunately, I did not find the correct URL anywhere, and from this link:PyTorch for JetPack 6.0DP
I realize the example commands are not 100 % useful.

So I downloaded The Pytorch binaries file : torch-2.2.0a0+6a974be.nv23.11-cp310-cp310-linux_aarch64.whl to my local machine (Ubuntu ) and through ssh (as I am accessing the board through headless mode) I transfer this file to Jetson Orin nano. Then uninstall torch-1.8.0 and install the torch-2.2.0a0+6a974be using

pip3 install torch-2.2.0a0+6a974be.nv23.11-cp310-cp310-linux_aarch64.whl

and install the torcvision v0.16.0.1 as per the normal installation steps suggested above.

Finally, the error vanishes and even verification test code results are as follows :

`2.2.0a0+6a974be # Torch Version

CUDA available: True

cuDNN version: 8904

/home/t-tech/Test/varification.py:5: UserWarning: The torch.cuda.DtypeTensor constructors are no longer recommended. It’s best to use methods such as torch.tensor(data, dtype=, device=‘cuda’) to create tensors. (Triggered internally at /opt/pytorch/pytorch/torch/csrc/tensor/python_tensor.cpp:83.)

a = torch.cuda.FloatTensor(2).zero_()
Tensor a = tensor([0., 0.], device=‘cuda:0’)
Tensor b = tensor([-0.7218, -0.1127], device=‘cuda:0’)
Tensor c = tensor([-0.7218, -0.1127], device=‘cuda:0’)

0.16.1 # Torchvision version`

@dusty_nv Thanks for your help.

Thanks @sarodeanil35, yes the URL for PyTorch 2.2 is https://developer.download.nvidia.cn/compute/redist/jp/v60dp/pytorch/torch-2.2.0a0+6a974be.nv23.11-cp310-cp310-linux_aarch64.whl

1 Like

Where did you get this URL? Because I tried This command with the URL :

wget https://developer.download.nvidia.com/compute/redist/jp/v60/pytorch/torch-2.2.0a0+6a974be.nv23.11-cp310-cp310-linux_aarch64.whl -O torch-2.2.0a0+6a974be.nv23.11-cp310-cp310-linux_aarch64.whl

Where I think I missed the dp part int v60dp Hence I got the below Not Found error:

--2023-12-31 15:33:40-- https://developer.download.nvidia.com/compute/redist/jp/v60/pytorch/torch-2.2.0a0+6a974be.nv23.11-cp310-cp310-linux_aarch64.whl Resolving developer.download.nvidia.com (developer.download.nvidia.com)... 152.199.39.144 Connecting to developer.download.nvidia.com (developer.download.nvidia.com)|152.199.39.144|:443... connected. HTTP request sent, awaiting response... 404 Not Found 2023-12-31 15:33:42 ERROR 404: Not Found.

The links to the wheels are listed in PyTorch for Jetson

https://developer.download.nvidia.cn/compute/redist/jp/v60dp/pytorch/torch-2.2.0a0+6a974be.nv23.11-cp310-cp310-linux_aarch64.whl is correct (with the v60dp part)

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