Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23418

How to solve the error for import torch on macOs?

$
0
0
ImportError                               Traceback (most recent call last)Input In [1], in <cell line: 1>()----> 1 import torchFile /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/torch/__init__.py:202, in <module>    200     if USE_GLOBAL_DEPS:    201         _load_global_deps()--> 202     from torch._C import *  # noqa: F403    204 # Appease the type checker; ordinarily this binding is inserted by the    205 # torch._C module initialization code in C    206 if TYPE_CHECKING:ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/torch/_C.cpython-39-darwin.so, 2): Library not loaded: @loader_path/../.dylibs/libomp.dylib  Referenced from: /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/torch/lib/libtorch_cpu.dylib  Reason: no suitable image found.  Did find:    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/torch/lib/../.dylibs/libomp.dylib: cannot load 'libomp.dylib' (load command 0x80000034 is unknown)    /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/torch/lib/../.dylibs/libomp.dylib: cannot load 'libomp.dylib' (load command 0x80000034 is unknown)

This is the error I'm getting on MacOs while working on Jupyter Notebook. I've installed Pytorch using the command "pip3 install torch torchvision torchaudio", and it showed it's been installed successfully. I tried to install Anaconda, but the Anaconda installation failed, so, installed torch using pip3.

What could be the reason?How can I solve this?

I'm trying and expecting to resolve this error.


Viewing all articles
Browse latest Browse all 23418

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>