How to Check Which Version of PyTorch Is Installed
Before you follow a guide or report a problem, you need to know which PyTorch you have, and whether it was built with CUDA. PyTorch tells you both from Python. This guide reads them for PyTorch 2.15.0 on an Apple M1 Pro, then reads the version without importing PyTorch at all.
Syntax
torch.__version__
torch.version.cuda
| Part | What it gives |
|---|---|
torch.__version__ | PyTorch's version as text, such as 2.15.0. Some builds add a label after a + that says what they were built for: +cu132 for CUDA 13.2, +cpu for the processor only |
torch.version.cuda | The version of CUDA the build was made with, as text such as 13.2, or None for a build without CUDA |
The Example
A two-line script prints both values in a project that has PyTorch.
Prerequisites
- A uv project with PyTorch. This guide uses PyTorch 2.15.0 with NumPy 2.5.5 on Python 3.15.2 and uv 0.13.10, on an Apple M1 Pro. Without NumPy in the project, PyTorch also prints a NumPy warning when it starts.
Step 1: Write the Script
import torch
print(torch.__version__)
print(torch.version.cuda)

Step 2: Run It
uv run python versions.py
2.15.0
None

PyTorch is version 2.15.0. torch.version.cuda is None because PyTorch for the Mac is built without CUDA. That doesn't mean there's no GPU: on an Apple silicon Mac, PyTorch reaches the GPU through MPS instead. The command works unchanged in PowerShell.
I could run it only on this Mac. Every build of PyTorch keeps these two values in a small file, torch/version.py, and reading that file inside the other published builds of PyTorch 2.15.0 shows what they print:
| Build of PyTorch 2.15.0 | torch.__version__ | torch.version.cuda |
|---|---|---|
| macOS, from PyPI (the run above) | 2.15.0 | None |
| Linux on x86-64, from PyPI | 2.15.0+cu132 | 13.2 |
| Windows, from PyPI | 2.15.0+cpu | None |
| Windows, from PyTorch's CUDA 13.2 index | 2.15.0+cu132 | 13.2 |
Step 3: Check It Without Importing PyTorch
Importing PyTorch takes a few seconds. uv can read the version from the project's environment instead:
uv pip show torch
Name: torch
Version: 2.15.0
Location: /Users/you/source/pytorch-basics/.venv/lib/python3.15/site-packages
Requires: filelock, fsspec, jinja2, networkx, setuptools, sympy, typing-extensions
Required-by: pytorch-basics

Version: 2.15.0 matches. Requires lists the packages PyTorch itself depends on, and Required-by names the project. uv pip show reads the package's own records, which leave out the + label for PyPI's builds: PyPI's Linux build records 2.15.0, while its torch.__version__ says 2.15.0+cu132. How to Check the Installed Version of a Python Package with uv covers uv pip show and the other ways uv reports versions.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
torch.version instead of torch.__version__ | print(torch.version) printed <module 'torch.version' from '…/torch/version.py'>: the module that holds the values, not the version | Print torch.__version__ |
Reading None from torch.version.cuda as "no GPU" | On a Mac, MPS still uses the GPU | Check the GPU directly |
| Running the check with the system's Python | It reports another install, or none at all | Run it with uv run in the project |
FAQ
What does +cu132 mean in a version?
The build was made with CUDA 13.2, so it can use an NVIDIA GPU. PyPI's Linux build is one; on Windows, the CUDA build comes from PyTorch's own index, as How to Install PyTorch with CUDA Using uv shows.
How do I compare versions in code?
Compare torch.__version__ with the version as text. It compares as a version, which plain text doesn't:
import torch
print(type(torch.__version__))
print(torch.__version__ >= "2.9")
print("2.15.0" >= "2.9")
uv run python version_order.py
<class 'torch.torch_version.TorchVersion'>
True
False
torch.__version__ is a TorchVersion, text that knows 2.15 comes after 2.9. Plain text compares character by character, and 1 comes before 9, so "2.15.0" >= "2.9" is False.
Conclusion
torch.__version__ printed 2.15.0 and torch.version.cuda printed None on an Apple M1 Pro, whose PyTorch is built without CUDA. PyTorch's Linux and Windows builds label their version +cu132 or +cpu. uv pip show torch read the version without importing PyTorch.
Additional Resources
- torch on PyPI — every PyTorch release.
- PyTorch releases — what changed in each version.
- How to Install PyTorch with uv — installing it in the first place.
