question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

import Error:

>>> import sentence_transformers
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jin/anaconda3/envs/zr/lib/python3.6/site-packages/sentence_transformers/__init__.py", line 3, in <module>
    from .datasets import SentencesDataset, ParallelSentencesDataset
  File "/home/jin/anaconda3/envs/zr/lib/python3.6/site-packages/sentence_transformers/datasets/__init__.py", line 1, in <module>
    from .ParallelSentencesDataset import ParallelSentencesDataset
  File "/home/jin/anaconda3/envs/zr/lib/python3.6/site-packages/sentence_transformers/datasets/ParallelSentencesDataset.py", line 4, in <module>
    from .. import SentenceTransformer
  File "/home/jin/anaconda3/envs/zr/lib/python3.6/site-packages/sentence_transformers/SentenceTransformer.py", line 24, in <module>
    from .models import Transformer, Pooling
  File "/home/jin/anaconda3/envs/zr/lib/python3.6/site-packages/sentence_transformers/models/__init__.py", line 1, in <module>
    from .Transformer import Transformer
  File "/home/jin/anaconda3/envs/zr/lib/python3.6/site-packages/sentence_transformers/models/Transformer.py", line 2, in <module>
    from transformers import AutoModel, AutoTokenizer, AutoConfig
  File "<frozen importlib._bootstrap>", line 1006, in _handle_fromlist
  File "/home/jin/anaconda3/envs/zr/lib/python3.6/site-packages/transformers/file_utils.py", line 1985, in __getattr__
    value = getattr(module, name)
  File "/home/jin/anaconda3/envs/zr/lib/python3.6/site-packages/transformers/file_utils.py", line 1984, in __getattr__
    module = self._get_module(self._class_to_module[name])
  File "/home/jin/anaconda3/envs/zr/lib/python3.6/site-packages/transformers/file_utils.py", line 1993, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
  File "/home/jin/anaconda3/envs/zr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/jin/anaconda3/envs/zr/lib/python3.6/site-packages/transformers/models/auto/modeling_auto.py", line 271, in <module>
    from ..tapas.modeling_tapas import (
  File "/home/jin/anaconda3/envs/zr/lib/python3.6/site-packages/transformers/models/tapas/modeling_tapas.py", line 51, in <module>
    from torch_scatter import scatter
  File "/home/jin/anaconda3/envs/zr/lib/python3.6/site-packages/torch_scatter/__init__.py", line 12, in <module>
    library, [osp.dirname(__file__)]).origin)
  File "/home/jin/anaconda3/envs/zr/lib/python3.6/site-packages/torch/_ops.py", line 105, in load_library
    ctypes.CDLL(path)
  File "/home/jin/anaconda3/envs/zr/lib/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libcudart.so.9.2: cannot open shared object file: No such file or directory

i have tried serial version of sentence-transformers, and it seems like version-independent, the torch version is 1.6.0+cu101 and i can import torch with gpu withou any Error. i have tried the method like but i have no permisssion of sudo:

export LD_LIBRARY_PATH=/usr/local/cuda-9.2/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda-9.2/bin:$PATH

as well as cuda-10.1

the information of /usr/local looks like this:

(zr) [jin@gpu03 local]$ pwd
/usr/local
(zr) [jin@gpu03 local]$ ll
总用量 12
drwxr-xr-x.  2 root root    6 7月  10 2020 bin
lrwxrwxrwx   1 root root   21 6月   1 2020 cuda -> /usr/local/cuda-10.1/
drwxr-xr-x  18 root root  319 6月   1 2020 cuda-10.1
drwxr-xr-x  18 root root  249 7月  20 2018 cuda-9.0
drwxr-xr-x.  2 root root    6 11月  5 2016 etc
drwxr-xr-x.  2 root root    6 11月  5 2016 games
drwxr-xr-x   8 root root   84 3月  16 14:21 gcc
drwxr-xr-x.  4 root root   33 8月  11 2020 include
drwxr-xr-x.  4 root root 8192 8月  11 2020 lib
drwxr-xr-x.  2 root root    6 11月  5 2016 lib64
drwxr-xr-x.  2 root root    6 11月  5 2016 libexec
drwxr-xr-x.  2 root root    6 11月  5 2016 sbin
drwxr-xr-x.  5 root root   49 7月  14 2018 share
drwxr-xr-x.  3 root root   48 3月  16 11:29 src

what should i do?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nreimerscommented, Aug 14, 2021

As mentioned, it appears that Cuda / pytorch is not correct installed. I recommend to create a new environment and to install there first pytorch with the correct Cuda version using the conda commands from the pytorch website

1reaction
nreimerscommented, Aug 12, 2021

It appears that torch is not correctly installed with CUDA.

Have a look here: https://pytorch.org/get-started

How to use conda to install pytorch with CUDA.

You can test it with:

import torch
print(torch.cuda.is_available())
a = torch.tensor([1], device='cuda')
Read more comments on GitHub >

github_iconTop Results From Across the Web

OSError: libcudart.so.9.2: cannot open shared object file: No ...
Stack Overflow for Teams – Start collaborating and sharing organizational knowledge.
Read more >
ImportError: libcudart.so.9.2: cannot open shared object file ...
ImportError: libcudart.so.9.2: cannot open shared object file: No such file or directory when I check /usr/local/cuda/lib64. I found libcudart.so.9.0. #564.
Read more >
OSError: libcudart.so.11.0: cannot open shared object file: No ...
Hi, my cuda version is 11.4, pytorch vison is 1.9.1+cu102. There is some questions during my installation, like this.
Read more >
libcuda.so.1: cannot open shared object file
libcuda.so.1: cannot open shared object file: No such file or directory. Yeynno. # See where the link is pointing. ls ...
Read more >
Solving The “Cannot Open Shared Object File - Baeldung
Learn what causes the "cannot open shared object file: No such file or directory" error in Linux, and how to fix it.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found