Tensorflow ImportError libcusolver.so.8.0 cannot open shared object file No such file or directory
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
The error ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory occurs when TensorFlow's GPU build cannot find the CUDA cuSOLVER library at the expected version. This typically means the installed CUDA toolkit version does not match what TensorFlow was compiled against, LD_LIBRARY_PATH does not include the CUDA library directory, or the CUDA installation is incomplete. The fix involves installing the correct CUDA version, setting environment variables, or creating symbolic links to match the expected library name.
Understanding the Error
TensorFlow GPU binaries are compiled against specific CUDA toolkit versions. Each TensorFlow release expects exact CUDA and cuDNN versions:
| TensorFlow | CUDA | cuDNN |
| 2.12-2.15 | 11.8 | 8.6 |
| 2.10-2.11 | 11.2 | 8.1 |
| 1.15 | 10.0 | 7.4 |
| 1.12 | 9.0 | 7.1 |
| 1.5-1.8 | 9.0 | 7.0 |
| 1.0-1.4 | 8.0 | 6.0 |
If TensorFlow expects libcusolver.so.8.0 (CUDA 8.0) but CUDA 9.0 or 11.x is installed, the library name does not match and the import fails.
Fix 1: Install the Correct CUDA Version
The most reliable fix is installing the exact CUDA version that matches your TensorFlow build. Check the official TensorFlow build configurations for the correct version pair.
Fix 2: Set LD_LIBRARY_PATH
Even when the correct CUDA version is installed, TensorFlow may not find the libraries if LD_LIBRARY_PATH does not include the CUDA directory.
Fix 3: Create Symbolic Links
Symlinks are a temporary workaround. They can cause runtime crashes if the actual library API differs from what TensorFlow expects. Only use this for minor version differences (e.g., 11.4 vs 11.2), not major version gaps.
Fix 4: Use pip with the Correct TensorFlow Build
Instead of changing your CUDA installation, install the TensorFlow version built for your existing CUDA toolkit.
Fix 5: Use NVIDIA Docker Container
Docker containers with pre-configured CUDA eliminate version mismatch issues entirely. This is the recommended approach for reproducible GPU environments.
Fix 6: conda Installation
Conda resolves CUDA version dependencies automatically, installing the correct CUDA toolkit version alongside TensorFlow without affecting the system-wide CUDA installation.
Diagnosing the Issue
Common Pitfalls
- CUDA toolkit version mismatch: TensorFlow 2.12 requires CUDA 11.8 but you installed CUDA 12.0. Each TensorFlow release is compiled against a specific CUDA version — check the official compatibility table before installing.
- Multiple CUDA installations conflicting: Having CUDA 10, 11, and 12 all installed on the same system can cause
/usr/local/cudato point to the wrong version. Useupdate-alternativesor explicit paths inLD_LIBRARY_PATHto select the correct one. - Symlink across major versions: Creating a symlink from
libcusolver.so.11tolibcusolver.so.8silences the import error but causes segfaults at runtime because the library ABI is incompatible. Only symlink within the same major version. - Forgetting
ldconfigafter installation: After installing CUDA or creating symlinks, runsudo ldconfigto refresh the shared library cache. Without this, the system linker may not find the new libraries. - GPU driver too old for CUDA version: CUDA 11.8 requires NVIDIA driver 520+. Run
nvidia-smito check your driver version. If the driver is too old, either upgrade the driver or install an older CUDA toolkit that matches your driver.
Summary
- This error means TensorFlow cannot find the CUDA cuSOLVER library at the expected version
- Install the exact CUDA toolkit version that matches your TensorFlow build (check the compatibility table)
- Set
LD_LIBRARY_PATHto include the CUDA library directory (/usr/local/cuda/lib64) - Use
condaor Docker to automatically manage CUDA version dependencies - Avoid creating symlinks across major CUDA versions — they cause runtime crashes
- Run
ldconfigafter any CUDA installation or library changes

