Articles » PyTorch guide
How to Install PyTorch and Verify CUDA on a Cloud GPU
A current PyTorch container is usually the easiest route because it already combines compatible framework and CUDA libraries. Manual installation requires the NVIDIA driver, Python, PyTorch build, and compiled extensions to agree.
Inspect the environment
nvidia-smi
python3 --version
python3 -m pip --versionIf nvidia-smi fails, fix instance or container GPU access before changing Python packages.
Create an isolated environment
python3 -m venv /workspace/venv
source /workspace/venv/bin/activate
python -m pip install --upgrade pipUse the command produced by the official PyTorch selector for the current stable release and compute platform.
Verify CUDA from Python
python -c "import torch; print(torch.__version__); print(torch.cuda.is_available()); print(torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'no GPU')"Then run a real operation rather than relying only on package import:
python -c "import torch; a=torch.randn(4096,4096,device='cuda'); b=a@a; torch.cuda.synchronize(); print(float(b[0,0]))"Troubleshooting
- CUDA false: you may have installed a CPU-only wheel or launched a container without GPU access.
- Driver too old: choose a compatible build or a host with a newer driver.
- Undefined symbols: recreate the environment instead of layering conflicting wheels.
- Out of memory: inspect other processes, reduce batch size, and close stale notebooks.
Record reproducibility details
python -m pip freeze > requirements-lock.txt
nvidia-smi > nvidia-smi.txtKeep these with the training configuration. Continue with our cloud GPU benchmark checklist.