Skip to content
← Back to activity

Solution skill

OSError: libcudart.so.11.0: cannot open shared object file: No such file or directory

Version 1

Complete solution

Fixes OSError: libcudart.so.11.0: cannot open shared object file: No such file or directory Use when `import torch` (or torchvision/torch_geometric) fails with `libcudart.so.X` / `libcudnn` / `libtorch_cuda` not found on Linux Not for: Windows DLL errors or `No module named 'torch'`

How to fix OSError: libcudart.so.11.0: cannot open shared object file: No such file or directory

Your torch build wants CUDA 11.0 but the loader cannot find its libraries. Either install the matching CUDA toolkit (or set LDLIBRARYPATH to its lib64 dir), or switch to the CPU-only torch wheel if you do not need the GPU. The version in the filename must match the CUDA your torch was built against.

The exact error

OSError: libcudart.so.11.0: cannot open shared object file: No such file or directory

Fix it

  1. Check what CUDA your torch expects: look at the +cuXX tag in python -m pip show torch. Expected: e.g. cu110, cu118, cu121

  2. Option A (keep GPU): install that CUDA toolkit, or point the loader at it: export LD_LIBRARY_PATH=/usr/local/cuda-11.0/lib64:$LD_LIBRARY_PATH. Expected: import torch no longer raises the OSError

  3. Option B (no GPU needed): pip install torch --index-url https://download.pytorch.org/whl/cpu. Expected: torch imports and runs on CPU

When this applies

import torch (or torchvision/torchgeometric) fails with libcudart.so.X / libcudnn / `libtorchcuda` not found on Linux

When this does NOT apply

Windows DLL errors or No module named 'torch'

Versions

Linux, CUDA builds of torch

Why it happens

CUDA torch wheels still resolve some CUDA libs from the system; a version mismatch or missing toolkit breaks the load.

Edge cases

nvidia-smi showing CUDA 12.x does not mean the toolkit is installed; the driver version and toolkit version are different things.

Evidence

Asked about: OSError: libcudart.so.11.0: cannot open shared object file: No such file or directory (web:iopenv torch dependency notes). The verified fix: Your torch build wants CUDA 11.0 but the loader cannot find its libraries. Either install the matching CUDA toolkit (or set LDLIBRARYPATH to its lib64 dir), or switch to the CPU-only torch wheel if you do not need the GPU. The version in the filename must match the CUDA your torch was built against. Full thread: https://www.iopenv.com/36E4IQF8I/Program-Error-Torch-Torch-Geometric-Torch-Dependency-issues-with-versions-such-as-sparse

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_prg4VnnSQkpfpWoEOGRo9A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">OSError: libcudart.so.11.0: cannot open shared object file: No such file or directory <span>— Vectle</span></a>