PyTorch: CUDA is not available

Question:

I’m trying to run PyTorch on a NVIDIA Jetson Nano and my project requires me to use CUDA. I’m running on Ubuntu 18.04 and Python 3.10.6. I followed this guide to install CUDA 11.6. Then using the instructions on PyTorch.org I installed PyTorch using this command:

pip install torch==1.12.0 torchvision==0.13.0 --extra-index-url https://download.pytorch.org/whl/cu116

But then when I try to verify it, it’s not available:

(env) $ python
Python 3.10.6 (main, Aug  2 2022, 15:11:03) [GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()
False
>>>

here’s the CUDA version:

(env) $ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Fri_Dec_17_18:16:35_PST_2021
Cuda compilation tools, release 11.6, V11.6.55
Build cuda_11.6.r11.6/compiler.30794723_0

And here is some information from PyTorch. Notice how it says CUDA used to build PyTorch: Could not collect.

(env) $ python -m torch.utils.collect_env
PyTorch version: 1.12.0
Is debug build: False
CUDA used to build PyTorch: Could not collect
ROCM used to build PyTorch: N/A

OS: Ubuntu 18.04.6 LTS (aarch64)
GCC version: (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0
Clang version: Could not collect
CMake version: version 3.10.2
Libc version: glibc-2.27

Python version: 3.10.6 (main, Aug  2 2022, 15:11:03) [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-4.9.253-tegra-aarch64-with-glibc2.27
Is CUDA available: False
CUDA runtime version: 11.6.55
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Probably one of the following:
/usr/lib/aarch64-linux-gnu/libcudnn.so.8.2.1
/usr/lib/aarch64-linux-gnu/libcudnn_adv_infer.so.8.2.1
/usr/lib/aarch64-linux-gnu/libcudnn_adv_train.so.8.2.1
/usr/lib/aarch64-linux-gnu/libcudnn_cnn_infer.so.8.2.1
/usr/lib/aarch64-linux-gnu/libcudnn_cnn_train.so.8.2.1
/usr/lib/aarch64-linux-gnu/libcudnn_ops_infer.so.8.2.1
/usr/lib/aarch64-linux-gnu/libcudnn_ops_train.so.8.2.1
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.1
[pip3] torch==1.12.0
[pip3] torchvision==0.13.0
[conda] Could not collect

Any help is appreciated. Thanks.

Asked By: Elías

||

Answers:

Downloading the compiled whl file from nvidia and installing it with pip did the trick (as suggested by @FlyingTeller).

wget https://nvidia.box.com/shared/static/p57jwntv436lfrd78inwl7iml6p13fzh.whl -O torch-1.8.0-cp36-cp36m-linux_aarch64.whl
pip install numpy torch-1.8.0-cp36-cp36m-linux_aarch64.whl
Answered By: Elías