Skip to content

Instantly share code, notes, and snippets.

@augustin-laurent
Created April 6, 2026 14:33
Show Gist options
  • Select an option

  • Save augustin-laurent/4cbcfc9ec5f6d7db7de18e03f858cc1d to your computer and use it in GitHub Desktop.

Select an option

Save augustin-laurent/4cbcfc9ec5f6d7db7de18e03f858cc1d to your computer and use it in GitHub Desktop.
cuda_arch_guide
Date of the guide : April, 2026

Introduction

In this post, I will provide the setup that makes the most sense on Arch Linux today to install NVIDIA CUDA for a GeForce RTX and newer NVIDIA GPUs. On current Arch, you can install everything you need from the official repositories, so AUR access is not required for the main CUDA setup.

CUDA is NVIDIA GPU computing platform. If you want GPU acceleration for workloads such as PyTorch, TensorFlow, or custom CUDA code, this is the stack you need. NVIDIA CUDA installation docs still focus on officially qualified distros, while TensorFlow explicitly says its Linux GPU instructions officially target Ubuntu and may also work on other distros. This guide is therefore an Arch-oriented practical guide using the current Arch packages and the official framework install methods.

Prerequisites

  • A computer running Arch Linux
  • A GeForce GTX/RTX or newer NVIDIA GPU
  • Internet access
  • Root access (sudo)
  • If you use a non-stock kernel such as linux-zen, install the matching kernel headers and use the DKMS flavor of the NVIDIA package. That is the practical Arch choice because nvidia-open is a prebuilt module package, while nvidia-open-dkms provides the module sources and the headers package supplies what DKMS needs to build against your running kernel.

Step-by-Step Guide

  1. Update Your System: First, make sure your system is up-to-date. Open your terminal and run:

    sudo pacman -Syu
  2. Install PyEnv: I choose to install PyEnv to manage my Python version, you can directly install Python if the version you use is compatible with CUDA.

    curl https://pyenv.run | bash

    Add theses lines to your .bashrc (or .zshrc) (located in your /home/username folder) :

    vim ~/.bashrc (or nano ~/.bashrc)
    export PATH="$HOME/.pyenv/bin:$PATH"
    eval "$(pyenv init --path)"
    eval "$(pyenv virtualenv-init -)"

    Now refresh the shell by either closing and reopening your terminal or execute this :

    exec $SHELL

    Now to be sure PyEnv is installed run :

    pyenv

    If the commands list is printed in your terminal, then you managed to installed otherwise go to PyEnv wiki to try fix the install : (https://github.com/pyenv/pyenv/wiki)

  3. Install Python:

    Now that we have PyEnv we can install Python, in this guide, I will use Python 3.12.13 (Most recent version at the date of the guide supported by both Tensorflow and PyTorch).

    pyenv install 3.12.13

    PyEnv have installed the 3.12.13 version, now we need to tell our system to use this version.

    pyenv global 3.12.13

    To ensure we have the right version execute :

    python --version

    If the command return 3.12.13 then you have the version you just installed as the version your system will use.

  4. Install the CUDA stack

    In this part I assume your already have the nvidia driver setup, keep in mind you have to use the property driver for Cuda. For the standard Arch kernel (linux) and custom (linux-zen, ...), install:

    # Safe path if the NVIDIA driver is already installed and working
    sudo pacman -S --needed cuda cudnn
  5. Reboot and verify the driver

    After installing the driver stack, reboot your machine, then verify that the driver is loaded correctly.

    reboot

    Once you are back in your session, run:

    nvidia-smi
    nvcc --version

    nvidia-smi is the standard first check to confirm that the NVIDIA driver is loaded and that your GPU is detected. nvcc --version confirms that the CUDA toolkit is present in the system.

  6. Create a Python environment

    Create and activate a virtual environment:

    python -m venv ~/venvs/cuda
    source ~/venvs/cuda/bin/activate
    pip install --upgrade pip
  7. Install PyTorch

    The official PyTorch install flow for Linux with NVIDIA is to use pip and select a CUDA-enabled wheel. PyTorch’s current pages show Linux wheels for recent CUDA branches, and the official version matrix includes a CUDA 13.0 wheel for PyTorch 2.9.0. If you read this later, use the selector on the PyTorch site for the newest recommended command.

    A concrete current example is:

    pip install torch==2.!!.0 torchvision==0.26.0 --index-url https://download.pytorch.org/whl/cu130

    To verify PyTorch GPU access:

    python -c "import torch; print(torch.cuda.is_available()); print(torch.version.cuda); print(torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'No GPU detected')"

    PyTorch’s own verification flow uses torch.cuda.is_available() to confirm that the GPU and CUDA stack are visible.

  8. Install TensorFlow

    TensorFlow current pip install guide recommends venv, pip install --upgrade pip, and then:

    pip install tensorflow[and-cuda]

    To verify TensorFlow GPU access:

    python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

    That is the current official TensorFlow GPU install method via pip. However, TensorFlow also states that on Linux it officially supports Ubuntu, while the same instructions may also work on other distros. On Arch, this usually works, but it is still best understood as a community path, not an officially Arch-specific support target.

  9. If TensorFlow does not detect the GPU

    TensorFlow current docs include a fix for cases where the GPU is not detected because components are not being found correctly inside the virtual environment. In that case, apply the following commands inside the activated venv:

    pushd $(dirname $(python -c 'print(__import__("tensorflow").__file__)'))
    ln -svf ../nvidia/*/lib/*.so* .
    popd
    ln -sf $(find $(dirname $(dirname $(python -c "import nvidia.cuda_nvcc; print(nvidia.cuda_nvcc.__file__)"))/*/bin/) -name ptxas -print -quit) $VIRTUAL_ENV/bin/ptxas

    Then test again:

    python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

    This workaround comes directly from TensorFlow current pip install guide for Linux GPU environments.

  10. Minimal CUDA / framework tests

    If you want a very small smoke test for PyTorch:

    python - <<'PY'
    import torch
    print("CUDA available:", torch.cuda.is_available())
    if torch.cuda.is_available():
        print("GPU:", torch.cuda.get_device_name(0))
        x = torch.rand(1024, 1024, device="cuda")
        y = torch.rand(1024, 1024, device="cuda")
        z = x @ y
        print("Tensor shape:", z.shape)
    PY

    And for TensorFlow:

    python - <<'PY'
    import tensorflow as tf
    print(tf.config.list_physical_devices('GPU'))
    a = tf.random.normal([1000, 1000])
    b = tf.random.normal([1000, 1000])
    c = tf.matmul(a, b)
    print(c.shape)
    PY

    If both commands run and your GPU is listed, your NVIDIA compute environment is working.

Notes

  • No AUR helper is needed for the base NVIDIA + CUDA installation on Arch. The core packages are in the official repositories.
  • nvidia-open is the modern default path on Linux because NVIDIA open kernel modules are supported on Turing and newer, and NVIDIA says that from driver branch 560 onward the open flavor is the default and suggested one.
  • TensorFlow Linux GPU instructions are officially for Ubuntu, even though the same steps may work on Arch. If you want the most “official” and least fragile TensorFlow GPU path, TensorFlow’s own Docker page says Docker is the easiest way to run TensorFlow on a GPU because the host only needs the NVIDIA driver.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment