1

Trying to install Scikit-learn on a Monterey Macbook Pro M1. Seems to install OK but when I run eg

import sklearn

I get the error,

ImportError: dlopen(/opt/homebrew/lib/python3.9/site-packages/scipy/linalg/_fblas.cpython-39-darwin.so, 0x0002): Library not loaded: '/opt/homebrew/opt/gcc/lib/gcc/11/libgfortran.5.dylib'
  Referenced from: '/opt/homebrew/lib/python3.9/site-packages/scipy/linalg/_fblas.cpython-39-darwin.so'
  Reason: tried: '/opt/homebrew/opt/gcc/lib/gcc/11/libgfortran.5.dylib' (no such file), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file)

I do have libgfortran.5.dylb,

locate libgfortran.5.dylib                                                                                       ✔  5   06:15:39   780 Mbps 
/opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/12/libgfortran.5.dylib
/opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/current/libgfortran.5.dylib
/opt/homebrew/lib/python3.10/site-packages/numpy/.dylibs/libgfortran.5.dylib
/usr/local/Cellar/gcc/11.1.0/lib/gcc/11/libgfortran.5.dylib

Do I have a PATH problem?. Searching around I see some old solutions to link the relevant library. How do I do that?

capnahab
  • 343
  • 3
  • 14
  • Related: https://stackoverflow.com/questions/22631026/dyld-library-not-loaded-usr-local-lib-libpng16-16-dylib-with-anything-php-rel – Marc Glisse Sep 28 '22 at 06:16

1 Answers1

2

This worked. ;)

pip install --upgrade --force-reinstall scikit-learn
capnahab
  • 343
  • 3
  • 14