To install CUDA on Arch Linux, follow these steps:
-
Install NVIDIA driver first (if not already installed) using:
sudo pacman -S nvidia -
Install the CUDA toolkit package from the official Arch repos:
sudo pacman -S cudaThis will install CUDA under
/opt/cuda. -
Add CUDA binaries to your PATH by appending to your shell config (
~/.bashrcor~/.zshrc):export PATH=/opt/cuda/bin:$PATH export LD_LIBRARY_PATH=/opt/cuda/lib64:$LD_LIBRARY_PATHThen reload your shell or source the config file.
-
(Optional) Verify the installation by compiling CUDA samples or checking the CUDA compiler version:
nvcc --version -
For deep learning frameworks and libraries, it is often recommended to use a Conda or Mamba environment to manage versions:
conda install -c nvidia cudaThis allows you to handle different CUDA versions alongside packages like PyTorch.
-
If you need cuDNN, download the appropriate version from NVIDIA's site matching your CUDA version, then copy the headers and libraries into
/opt/cuda/includeand/opt/cuda/lib64.