I am getting error when importing torch and torch vision
I installed torch and torchvision using pip3 on MAC. When I imported the same, getting the below error.

Environment:

OS : macOS High Sierra
Python : 3.7
pip : 3
Pytorch 1.1


code:

import torch
import torchvision


Error:


  ImportError                               Traceback (most recent call
  last)  in 
        1 import numpy as np
        2 from glob import glob
  ----> 3 import torch
        4 import torchvision
        5 from torchvision import datasets
  
  /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torch/init.py
  in 
       77 del _dl_flags
       78 
  ---> 79 from torch._C import *
       80 
       81 all += [name for name in dir(_C)
  
  ImportError:
  dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torch/_C.cpython-37m-darwin.so,
  9): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib
  Referenced from:
  /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torch/lib/libshm.dylib
  Reason: image not found


Any help on solving this error would be appreciated.

i think

$ brew install libomp

can help u, cause i solve the same problem by it.  

according

github-issue-"libomp.dylib can't be loaded"
