OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

"import torch" giving an import error: from torch._C import

  • Thread starter Thread starter Keegan
  • Start date Start date
K

Keegan

Guest
I set up a torch virtual environment in ubuntu and installed torch itself with the following commands:

Code:
(torchgpu) $ pip install --upgrade pip setuptools wheel
(torchgpu) $ pip install --upgrade opencv-python opencv-contrib-python
(torchgpu) $ pip install --upgrade torch torchvision torchaudio

When I try to verify that torch is installed correctly, I get this:

Code:
(torchgpu) $ python
>>> import torch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/USER/venvs/torchgpu/lib/python3.10/site-packages/torch/__init__.py", line 239, in <module>
    from torch._C import *  # noqa: F403
ImportError: /home/USER/venvs/torchgpu/lib/python3.10/site-packages/torch/lib/../../nvidia/cusparse/lib/libcusparse.so.12: undefined symbol: __nvJitLinkAddData_12_1, version libnvJitLink.so.12
<p>I set up a torch virtual environment in ubuntu and installed torch itself with the following commands:</p>
<pre><code>(torchgpu) $ pip install --upgrade pip setuptools wheel
(torchgpu) $ pip install --upgrade opencv-python opencv-contrib-python
(torchgpu) $ pip install --upgrade torch torchvision torchaudio
</code></pre>
<p>When I try to verify that torch is installed correctly, I get this:</p>
<pre><code>(torchgpu) $ python
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/USER/venvs/torchgpu/lib/python3.10/site-packages/torch/__init__.py", line 239, in <module>
from torch._C import * # noqa: F403
ImportError: /home/USER/venvs/torchgpu/lib/python3.10/site-packages/torch/lib/../../nvidia/cusparse/lib/libcusparse.so.12: undefined symbol: __nvJitLinkAddData_12_1, version libnvJitLink.so.12
</code></pre>
 

Latest posts

Top