Install NVIDIA GeForce RTX 3060 for Machine Learning

This guide installs an NVIDIA GeForce RTX 3060 on Ubuntu for machine-learning work and verifies that Python frameworks can use it. The original step list is kept below; the added sections explain how the driver, CUDA and frameworks fit together and how to troubleshoot a failed install.

Step 1: Prepare Your System

Before installing the NVIDIA drivers, update your system and install the necessary packages.

sudo apt update
sudo apt upgrade

Install required build tools and headers:

sudo apt install build-essential linux-headers-$(uname -r)

Step 2: Install NVIDIA Drivers

  1. Add the NVIDIA PPA:

    Add the official NVIDIA PPA to get the latest drivers:

    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt update
  2. Identify the Recommended Driver:

    Find the recommended driver for your GPU using the following command:

    ubuntu-drivers devices

    The output will suggest the best driver for your system. For example, it may recommend nvidia-driver-560.

  3. Install the Recommended Driver:

    Replace nvidia-driver-xxx with the recommended driver, such as nvidia-driver-560:

    sudo apt install nvidia-driver-560
  4. Reboot Your System:

    Reboot your machine to apply the changes:

    sudo reboot

Step 3: Install CUDA (Optional)

If you plan to use CUDA for GPU computing, you can install it using the following command:

sudo apt install nvidia-cuda-toolkit

Step 4: Verify Installation

After rebooting, you can check if the driver is installed and working properly by running:

alias nv1='nvtop'
alias nv2='nvidia-smi'
    

This will display details about your installed GPU and the driver version.

Step 5: Enable Microphone on Chrome

Insecure origins treated as secure: http://192.168.1.190:8080/

chrome://flags/ 

1. Overview of the stack

The NVIDIA Software Stack for Machine Learning PyTorch / TFframework cuDNN, cuBLASGPU math libraries CUDA runtimebundled in wheels NVIDIA driverkernel module + libcuda RTX 3060Ampere GPU, 12 GB Only the driver must be installed system-wide. PyTorch pip wheels bundle their own CUDA runtime and cuDNN, so the system CUDA toolkit is needed only to compile CUDA code (nvcc) or build extensions.

The RTX 3060 is an Ampere-generation consumer GPU; the common desktop model has 12 GB of GDDR6 memory, which is generous for its class and makes it a popular entry card for local fine-tuning of small models, Stable Diffusion, and running quantised language models. Using it from Python needs a layered stack. At the bottom is the proprietary NVIDIA kernel driver, which also installs libcuda and the nvidia-smi tool. Above it sits the CUDA runtime and math libraries (cuBLAS, cuDNN), and on top the framework. A key point that saves a lot of confusion: the driver is the only piece that must match the system. Frameworks installed with pip ship their own CUDA runtime, and they work as long as the driver is new enough for that runtime version. The nvidia-cuda-toolkit package in Step 3 is only needed to compile CUDA code yourself.

2. Install and verify sequence

Install and Verify Sequence Update OSheaders, build tools Install driverubuntu-drivers Rebootload module nvidia-smidriver OK? Python venvpip install torch cuda.is_available()end-to-end check If nvidia-smi fails, fix the driver before touching Python. If it works but torch sees no GPU, the problem is the framework build (CPU-only wheel) rather than the driver.

Work bottom-up and verify each layer before moving on. Install headers and build tools so the kernel module can be built through DKMS, install the recommended driver, and reboot. Then confirm nvidia-smi lists the GPU, its memory and the driver version; the "CUDA Version" it prints is the highest CUDA runtime the driver supports, not an installed toolkit. Only then create a virtual environment and install a CUDA-enabled framework build. Secure Boot can block the unsigned module; Ubuntu prompts to enrol a Machine Owner Key during installation, and that step must be completed at the next boot.

3. Worked example: verify from Python

# driver layer
nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv
lsmod | grep nvidia

# framework layer
python3 -m venv ~/venv-gpu && source ~/venv-gpu/bin/activate
pip install torch            # default Linux wheel includes CUDA support
import torch
print("torch", torch.__version__, "built for CUDA", torch.version.cuda)
print("GPU available:", torch.cuda.is_available())
if torch.cuda.is_available():
    print(torch.cuda.get_device_name(0))
    free, total = torch.cuda.mem_get_info()
    print(f"memory free {free/2**30:.1f} GiB of {total/2**30:.1f} GiB")
    a = torch.randn(4096, 4096, device="cuda")
    b = a @ a.T                     # runs a cuBLAS matmul on the GPU
    torch.cuda.synchronize()
    print("matmul ok:", b.shape)

If the last line prints, every layer works: driver, bundled CUDA runtime, cuBLAS and the framework. nvtop (aliased as nv1 above) shows live utilisation and memory while the matmul runs.

4. Choices: driver source, CUDA toolkit, containers

OptionProsCons
Ubuntu repository driver (ubuntu-drivers)Signed, tested with the kernel, simplestMay lag the newest release
graphics-drivers PPANewer driversLess tested; occasional breakage on kernel upgrades
NVIDIA .run installerLatest versionBypasses the package manager; breaks on kernel updates
System CUDA toolkitNeeded for nvcc and custom kernelsNot required for pip-installed frameworks
Docker with NVIDIA Container ToolkitIsolated CUDA versions per projectExtra layer; host still needs the driver

5. Pitfalls and troubleshooting