title: Unable to use scikit-learn package on M1 Mac Pro
body: <p>sklearn intallation steps on m1 mac:
  brew install openblas
  export OPENBLAS=$(/opt/homebrew/bin/brew --prefix openblas)
  export CFLAGS=&quot;-falign-functions=8 ${CFLAGS}&quot;
  pip install scikit-learn</p>
  <p>While importing the sklearn module in python, I am receiving this error:</p>
  <pre><code>ImportError                               Traceback (most recent call last)
  /var/folders/xh/557wxmb52b9fpjjzhgkr335m0000gn/T/ipykernel_9797/2452514981.py in &lt;module&gt;
        2 import matplotlib.pyplot as plt
        3 import pandas as pd
  ----&gt; 4 from sklearn.model_selection import train_test_split
        5 from sklearn.metrics import cohen_kappa_score, accuracy_score
        6 import scipy
  
  /opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/python3.9/site-packages/sklearn/__init__.py in &lt;module&gt;
       80     from . import _distributor_init  # noqa: F401
       81     from . import __check_build  # noqa: F401
  ---&gt; 82     from .base import clone
       83     from .utils._show_versions import show_versions
       84 
  
  /opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/python3.9/site-packages/sklearn/base.py in &lt;module&gt;
       15 from . import __version__
       16 from ._config import get_config
  ---&gt; 17 from .utils import _IS_32BIT
       18 from .utils._tags import (
       19     _DEFAULT_TAGS,
  
  /opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/python3.9/site-packages/sklearn/utils/__init__.py in &lt;module&gt;
       26 from ..exceptions import DataConversionWarning
       27 from .deprecation import deprecated
  ---&gt; 28 from .fixes import np_version, parse_version
       29 from ._estimator_html_repr import estimator_html_repr
       30 from .validation import (
  
  /opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/python3.9/site-packages/sklearn/utils/fixes.py in &lt;module&gt;
       18 import scipy.sparse as sp
       19 import scipy
  ---&gt; 20 import scipy.stats
       21 from scipy.sparse.linalg import lsqr as sparse_lsqr  # noqa
       22 import threadpoolctl
  
  /opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/python3.9/site-packages/scipy/stats/__init__.py in &lt;module&gt;
      439 &quot;&quot;&quot;
      440 
  --&gt; 441 from .stats import *
      442 from .distributions import *
      443 from .morestats import *
  
  /opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/python3.9/site-packages/scipy/stats/stats.py in &lt;module&gt;
       35 from numpy import array, asarray, ma
       36 
  ---&gt; 37 from scipy.spatial.distance import cdist
       38 from scipy.ndimage import measurements
       39 from scipy._lib._util import (check_random_state, MapWrapper,
  
  /opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/python3.9/site-packages/scipy/spatial/__init__.py in &lt;module&gt;
       96 from .kdtree import *
       97 from .ckdtree import *
  ---&gt; 98 from .qhull import *
       99 from ._spherical_voronoi import SphericalVoronoi
      100 from ._plotutils import *
  
  ImportError: dlopen(/opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/python3.9/site-packages/scipy/spatial/qhull.cpython-39-darwin.so, 0x0002): Library not loaded: @rpath/liblapack.3.dylib
    Referenced from: /opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/python3.9/site-packages/scipy/spatial/qhull.cpython-39-darwin.so
    Reason: tried: '/opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/liblapack.3.dylib' (no such file), '/opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/liblapack.3.dylib' (no such file), '/opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/python3.9/site-packages/scipy/spatial/../../../../liblapack.3.dylib' (no such file), '/opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/liblapack.3.dylib' (no such file), '/opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/liblapack.3.dylib' (no such file), '/opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/python3.9/site-packages/scipy/spatial/../../../../liblapack.3.dylib' (no such file), '/opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/liblapack.3.dylib' (no such file), '/opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/bin/../lib/liblapack.3.dylib' (no such file), '/opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/liblapack.3.dylib' (no such file), '/opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/bin/../lib/liblapack.3.dylib' (no such file), '/usr/local/lib/liblapack.3.dylib' (no such file), '/usr/lib/liblapack.3.dylib' (no such file)
  </code></pre>
  <p>I tried installing from conda, but there is not solution. Can anyone please help, how can i add the missing files</p>