OSError: libcurand.so.10 while importing torch

I encountered a problem after installing pytorch following PyTorch for Jetson - version 1.10 now available - Jetson & Embedded Systems / Jetson Nano - NVIDIA Developer Forums on my Jetson:tx2 device.

This error message appeared when importing torch:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/torch/__init__.py", line 195, in <module>
    _load_global_deps()
  File "/usr/local/lib/python3.6/dist-packages/torch/__init__.py", line 148, in _load_global_deps
    ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
  File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libcurand.so.10: cannot open shared object file: No such file or directory

The version of pytorch(1.8.0) and jetpack(4.5) matched, but I noticed that libcurand.so.10 was missing in /usr/local/cuda-10.2/lib64. How can I solve this problem?

Hi @arnoldzhu33, I wonder if you have CUDA Toolkit installed ok - can you try running:

sudo apt-get install cuda-toolkit-10-2

I tried to re-install my CUDA Toolkit by the command above, but got error messages shown below:

Unpacking cuda-libraries-dev-10-2 (10.2.89-1) ... Selecting previously unselected package cuda-nvml-dev-10-2. Preparing to unpack .../24-cuda-nvml-dev-10-2_10.2.89-1_arm64.deb ... Unpacking cuda-nvml-dev-10-2 (10.2.89-1) ... dpkg: error processing archive /tmp/apt-dpkg-install-v987x5/24-cuda-nvml-dev-10-2_10.2.89-1_arm64.deb (--unpack): trying to overwrite '/usr/local/cuda-10.2/lib64', which is also in package cuda-cudart-10-2 10.2.89-1 No apport report written because MaxReports is reached already

Is this a problem that I can solve, much thanks!

Hmm not sure…you might need to uninstall it first?

BTW this is what my /usr/local/cuda-10.2/lib64 looks like:

$ ls /usr/local/cuda-10.2/lib64
libcudadevrt.a                libcusolver.so            libnppicom_static.a      libnppitc.so
libcudart.so                  libcusolver.so.10         libnppidei.so            libnppitc.so.10
libcudart.so.10.2             libcusolver.so.10.3.0.89  libnppidei.so.10         libnppitc.so.10.2.1.89
libcudart.so.10.2.89          libcusolver_static.a      libnppidei.so.10.2.1.89  libnppitc_static.a
libcudart_static.a            libcusparse.so            libnppidei_static.a      libnpps.so
libcufft.so                   libcusparse.so.10         libnppif.so              libnpps.so.10
libcufft.so.10                libcusparse.so.10.3.1.89  libnppif.so.10           libnpps.so.10.2.1.89
libcufft.so.10.1.2.89         libcusparse_static.a      libnppif.so.10.2.1.89    libnpps_static.a
libcufft_static.a             liblapack_static.a        libnppif_static.a        libnvgraph.so
libcufft_static_nocallback.a  libmetis_static.a         libnppig.so              libnvgraph.so.10
libcufftw.so                  libnppc.so                libnppig.so.10           libnvgraph.so.10.2.89
libcufftw.so.10               libnppc.so.10             libnppig.so.10.2.1.89    libnvgraph_static.a
libcufftw.so.10.1.2.89        libnppc.so.10.2.1.89      libnppig_static.a        libnvperf_host.so
libcufftw_static.a            libnppc_static.a          libnppim.so              libnvperf_target.so
libcuinj64.so                 libnppial.so              libnppim.so.10           libnvrtc-builtins.so
libcuinj64.so.10.2            libnppial.so.10           libnppim.so.10.2.1.89    libnvrtc-builtins.so.10.2
libcuinj64.so.10.2.89         libnppial.so.10.2.1.89    libnppim_static.a        libnvrtc-builtins.so.10.2.89
libculibos.a                  libnppial_static.a        libnppist.so             libnvrtc.so
libcupti.so                   libnppicc.so              libnppist.so.10          libnvrtc.so.10.2
libcupti.so.10.2              libnppicc.so.10           libnppist.so.10.2.1.89   libnvrtc.so.10.2.89
libcupti.so.10.2.75           libnppicc.so.10.2.1.89    libnppist_static.a       libnvToolsExt.so
libcurand.so                  libnppicc_static.a        libnppisu.so             libnvToolsExt.so.1
libcurand.so.10               libnppicom.so             libnppisu.so.10          libnvToolsExt.so.1.0.0
libcurand.so.10.1.2.89        libnppicom.so.10          libnppisu.so.10.2.1.89   stubs
libcurand_static.a            libnppicom.so.10.2.1.89   libnppisu_static.a

Yeah, my toolkit is missing a lot of libs. When I tried uninstalling some new errors appeared :(
I’ll try to figure it out and update once I make progress.

Hmm ok…if you spend too much time on it, you may just want to re-flash the device with SDK Manager (after backing up your work)

Yeah, I’ll do that if I messed up to far, lol. Thanks :D

After I installed torch and CUDA toolkit by sudo apt-get install CUDA-toolkit-10-2, an error message appeared:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/lecoan/.local/lib/python3.6/site-packages/torch/__init__.py", line 195, in <module>
    _load_global_deps()
  File "/home/lecoan/.local/lib/python3.6/site-packages/torch/__init__.py", line 148, in _load_global_deps
    ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
  File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libcudnn.so.8: cannot open shared object file: No such file or directory

I noticed the shared object file reported missing was different from the previous one. Wonder how I can solve this problem…

Much thanks in advance!

OK, it appears that next you need to install cuDNN packages - can you run sudo apt-get install libcudnn8-dev next?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.