Hi everyone,
Ive just installed torch and torchvision on my anaconda shell:
packages in environment at C:\Users\benja\anaconda3:
Name Version Build Channel
pytorch 2.5.1 py3.11_cpu_0 pytorch
pytorch-mutex 1.0 cpu pytorch
packages in environment at C:\Users\benja\anaconda3:
Name Version Build Channel
torchvision 0.20.1 py311_cpu pytorch
However, when I am trying import torch and torchvision, the following message is displayed:
ImportError Traceback (most recent call last)
Cell In[7], line 3
1 import inspect
2 import torch
----> 3 import torchvision
4 from torch import nn
5 from torch import optim
File ~\anaconda3\Lib\site-packages\torchvision_init_.py:9
5 import torch
7 # Don’t re-order these, we need to load the _C extension (done when importing
8 # .extensions) before entering _meta_registrations.
----> 9 from .extension import _HAS_OPS # usort:skip
10 from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils # usort:skip
12 try:
File ~\anaconda3\Lib\site-packages\torchvision\extension.py:6
2 import sys
4 import torch
----> 6 from ._internally_replaced_utils import _get_extension_path
9 _HAS_OPS = False
12 def _has_ops():
File ~\anaconda3\Lib\site-packages\torchvision_internally_replaced_utils.py:4
1 import importlib.machinery
2 import os
----> 4 from torch.hub import _get_torch_home
7 _HOME = os.path.join(_get_torch_home(), “datasets”, “vision”)
8 _USE_SHARDED_DATASETS = False
File ~\anaconda3\Lib\site-packages\torch\hub.py:22
19 from urllib.request import Request, urlopen
21 import torch
—> 22 from torch.serialization import MAP_LOCATION
25 class _Faketqdm: # type: ignore[no-redef]
26 def init(self, total=None, disable=False, unit=None, *args, **kwargs):
File ~\anaconda3\Lib\site-packages\torch\serialization.py:35
33 import torch
34 import torch._weights_only_unpickler as _weights_only_unpickler
—> 35 from torch._sources import get_source_lines_and_file
36 from torch._utils import _import_dotted_name
37 from torch.storage import _get_dtype_from_pickle_storage_type
File ~\anaconda3\Lib\site-packages\torch_sources.py:8
5 from textwrap import dedent
6 from typing import Any, List, NamedTuple, Optional, Tuple
----> 8 from torch._C import ErrorReport
9 from torch._C._jit_tree_views import SourceRangeFactory
12 def get_source_lines_and_file(
13 obj: Any,
14 error_msg: Optional[str] = None,
15 ) → Tuple[List[str], int, Optional[str]]:
ImportError: DLL load failed while importing _C: Das angegebene Modul wurde nicht gefunden.
How to solve this issue?