Hi Friends,
I just got my Mac Mini with M2 Pro Chip today, and so excited to install and run pytorch on it. I followed the instruction Accelerated PyTorch training on Mac - Metal - Apple Developer
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh
sh Miniconda3-latest-MacOSX-arm64.sh
conda create -n torch
conda activate torch
conda install pytorch torchvision torchaudio -c pytorch-nightly
without any error.
However when I actually import the package, I saw below error. Sincerely appreciate your advice about how to solve it or let me know it is not solvable … (I tried hard to google search it, yet no luck )
(torch) Evas-Mac-mini:Projects evah$ python
Python 3.11.3 (main, Apr 19 2023, 18:49:55) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/evah/miniconda3/envs/torch/lib/python3.11/site-packages/torch/__init__.py", line 17, in <module>
import ctypes
File "/Users/evah/miniconda3/envs/torch/lib/python3.11/ctypes/__init__.py", line 8, in <module>
from _ctypes import Union, Structure, Array
ImportError: dlopen(/Users/evah/miniconda3/envs/torch/lib/python3.11/lib-dynload/_ctypes.cpython-311-darwin.so, 0x0002): Library not loaded: @rpath/libffi.8.dylib
Referenced from: <984D5B9C-4A47-3C59-BA2F-19CA5FA76707> /Users/evah/miniconda3/envs/torch/lib/python3.11/lib-dynload/_ctypes.cpython-311-darwin.so
Reason: tried: '/Users/evah/miniconda3/envs/torch/lib/python3.11/lib-dynload/../../libffi.8.dylib' (no such file), '/Users/evah/miniconda3/envs/torch/lib/python3.11/lib-dynload/../../libffi.8.dylib' (no such file), '/Users/evah/miniconda3/envs/torch/bin/../lib/libffi.8.dylib' (no such file), '/Users/evah/miniconda3/envs/torch/bin/../lib/libffi.8.dylib' (no such file), '/usr/local/lib/libffi.8.dylib' (no such file), '/usr/lib/libffi.8.dylib' (no such file, not in dyld cache)
>>>