torch.cuda.is_available() Returns False: Verify the GPU Runtime Before Reinstalling
PyTorch & CUDA(Updated )

torch.cuda.is_available() Returns False: Verify the GPU Runtime Before Reinstalling

Correction, November 12, 2026: The original guide recommended uninstalling all Torch packages, purging pip cache, adding host driver PPAs, reinstalling a specific 550-series NVIDIA driver, rebooting, modifying startup kernel modules and restarting Docker as nearly universal fixes. It also presented an example CUDA test result as if every machine should produce it. These changes are intrusive and can break unrelated GPU workloads. This revision uses the exact failing Python environment and read-only diagnostics first.

PyTorch’s torch.cuda.is_available() API returns a Boolean describing whether CUDA is currently available to that Python process. A False result is a symptom, not a unique diagnosis: the active interpreter, installed PyTorch build, available devices, driver compatibility, container exposure and runtime environment all matter.

It is not proof that your NVIDIA GPU has physically failed or that reinstalling every CUDA package is required.

1. Identify the process that reports False

If you can safely run the intended Python interpreter, check it without installing or deleting packages:

command -v python3
python3 --version
python3 -m pip show torch

In the same trusted and authorized environment, the following read-only query reports the installed PyTorch build version, CUDA build metadata and NVIDIA CUDA availability. It is not a universal classifier for every accelerator backend: ROCm and other backends require their own checks.

python3 -c "import torch; print('torch:', torch.__version__); print('wheel CUDA:', torch.version.cuda); print('available:', torch.cuda.is_available()); print('count:', torch.cuda.device_count())"

Do not treat the sample command as a forensic check for a potentially compromised Python installation. If you suspect malicious Python startup hooks, use a separate incident-response workflow instead.

The current PyTorch extension source branches on torch.version.cuda when labeling CUDA and CPU extension build-cache paths. This is build metadata, not a device-health test, and should be interpreted against the installed PyTorch release. A None value is consistent with a build that lacks CUDA support, but do not use this metadata alone to establish the complete failure cause. A CUDA version string likewise does not prove the host GPU or driver is accessible; inspect the actual installed packages and device permissions.

Record both the active interpreter path and the process used by your IDE, container, notebook or service. Two terminals can import different Torch wheels even on the same host.

2. Confirm host GPU visibility separately

On an authorized Linux host, inspect GPU and driver information with the official NVIDIA System Management Interface:

nvidia-smi

This utility reports NVIDIA driver/GPU state when supported and properly configured. Success does not establish that a separate Python environment or container can use CUDA: the two processes may have different libraries, permissions and device visibility.

If nvidia-smi fails, inspect the actual error and the system’s approved driver-management logs. A mismatched userspace library and loaded kernel module is different from an absent device or a permissions problem. Review the installed driver and loaded kernel-module versions according to the relevant operating-system documentation before planning a change.

The NVIDIA minor-version compatibility table documents the supported CUDA major-version families and their minimum driver requirements, including feature limitations. Check the versioned compatibility table for your installed CUDA runtime, not a blog’s fixed “driver 550 for all CUDA 12.4 workloads” rule. Packaging, forward-compatibility support and supported accelerator generation can change that choice.

Do not modify /usr/bin/python3, host NVIDIA modules or system-wide linker paths merely because torch.cuda.is_available() returned False.

3. Install the correct Torch build only if that is the root cause

The official PyTorch installation selector provides package-manager commands according to the selected OS, package type and compute platform. Validate Python version compatibility separately for the selected release.

If your current interpreter imported a CPU-only build but the target application requires NVIDIA CUDA, prepare an approved isolated environment and follow the current PyTorch selector. Do not immediately uninstall the existing Torch packages from a working production environment, and do not purge the entire pip cache as a diagnostic step.

Pin the Torch, torchvision and torchaudio versions compatible with each other and the application’s model stack. A previously installed +cpu or +cuXXX suffix is useful historical evidence but not a universal requirement for every future wheel naming scheme.

The PyTorch C++/CUDA extension guide distinguishes compilation of custom CUDA source from using an installed PyTorch package. Do not install or reconfigure a host CUDA compiler solely because an already-built PyTorch wheel reports CUDA unavailable; inspect its build and driver first.

4. Check container exposure independently

A GPU visible on the host but unavailable inside a Docker container requires a separate container-level diagnosis. Possible differences include GPU grants, runtime configuration, permissions and the PyTorch build installed inside the container. Docker’s default isolation and the NVIDIA Container Toolkit setup guide explain the supported GPU runtime configuration.

Before changing the Docker daemon, record:

  • The actual container image digest and its Torch build.
  • The host GPU visibility and driver version.
  • Which GPUs the container was intentionally granted.
  • The container runtime and device-request configuration.
  • Whether the service has an authorized, maintenance-window change plan.

A generic instruction to restart Docker or grant all GPUs to every container is not appropriate. A restart can interrupt other services; wider device access can violate workload isolation. Use narrowly scoped GPU assignments, and perform daemon-level changes only after an authorized administrator confirms the actual cause.

The Docker GPU device documentation describes GPU device-request options. The presence of a GPU reservation in a Compose file does not prove the installed PyTorch build or the host driver is compatible.

5. Avoid blind kernel-module and Secure Boot changes

Host driver and device access issues should be reviewed under the operating system’s driver-management procedure, based on exact logs and installed driver versions. A missing device node or an unexpected module state does not justify modifying every GPU host.

In particular, do not automatically reload kernel modules, append boot-time module configuration, disable Secure Boot or reboot to fix a PyTorch Boolean. Those actions affect system security and availability. Collect the first underlying error and involve the host administrator when the evidence points to driver/module management.

6. A bounded validation checklist

Once an authorized change is made in a controlled environment:

  1. Recheck the same interpreter, exact Torch version and torch.version.cuda.
  2. Confirm the intended GPU is visible to that process under its actual device permissions.
  3. Verify torch.cuda.is_available() and the reported device count.
  4. On a dedicated non-production test environment, optionally perform a small bounded CUDA tensor operation after checking free VRAM and resource permissions.
  5. Validate the actual application’s model path and accelerator behavior, not a printed example result.
  6. Record the previous environment configuration and rollback if unrelated workloads regress.

A true Boolean does not guarantee that a large training job will avoid OOM, that CUDA extensions compile or that every kernel works. Likewise, one successful small tensor test is not a general GPU health certification.

This article provides documentation-backed troubleshooting. No NVIDIA driver, kernel module, Docker daemon, pip environment or physical GPU workload was modified or executed during this editorial correction.

Primary references

Technical correction, November 12, 2026. Original publication date and URL are unchanged. The former broad reinstall/reboot recipe and unverified “expected result” have been removed.

BC

Written by B. Cho

Systems & AI Infrastructure Engineer

Specializing in GPU inference engines (vLLM, SGLang, Ollama), CUDA memory allocation, and Model Context Protocol (MCP) infrastructure on Linux workstations.