Sunday, September 5, 2021

Fixing "ImportError: cannot open shared object file: No such file or directory" in Ubuntu 18.04

 If you're using Nvidia CUDA 10.1.243 in your software development, either directly or indirectly and encountered: "ImportError: cannot open shared object file: No such file or directory", it's caused by incorrect location of the said library. Nvidia have moved the location of the library form cuda-10.1 direcctory to cuda-10.2 directory. I know, this is rather insane. But it is what it is in Ubuntu 18.04, if you installed Cuda from Nvidia's *.deb package. 

The FIX: 

Add the path to cuda-10.2 library into your LD_LIBRARY_PATH, akin to this explanation in stackoverflow:, i.e. add this line to your shell init file (*.profile or similar ones):

export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} 
The line above assumes you've installed Cuda in its default installation location, i.e. /usr/local. You need to modify this value if you installed Cuda in non-default location.  

Post a Comment

No comments: