[Python] ImportError: The `scipy` install you are using seems to be broken, (extension modules...

Discussão em 'Python' iniciado por Stack, Maio 18, 2025.

  1. Stack

    Stack Membro Participativo

    I'm coniststently getting this error when trying to use scipy or sklearn packages in Python3.9 via a Jupyter notebook.

    The error is:

    ---------------------------------------------------------------------------
    ImportError Traceback (most recent call last)
    ~/opt/anaconda3/lib/python3.9/site-packages/scipy/__init__.py in <module>
    165 try:
    --> 166 from scipy._lib._ccallback import LowLevelCallable
    167 except ImportError as e:

    ~/opt/anaconda3/lib/python3.9/site-packages/scipy/_lib/_ccallback.py in <module>
    ----> 1 from . import _ccallback_c
    2
    3 import ctypes

    ImportError: dlopen(/Users/dn/opt/anaconda3/lib/python3.9/site-packages/scipy/_lib/_ccallback_c.cpython-39-darwin.so, 0x0002): tried: '/Users/dn/opt/anaconda3/lib/python3.9/site-packages/scipy/_lib/_ccallback_c.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

    The above exception was the direct cause of the following exception:

    ImportError Traceback (most recent call last)
    /var/folders/d7/q_fznsr95_97r6lp_mx_vp640000gn/T/ipykernel_37825/912110602.py in <module>
    1 #import scipy
    ----> 2 from sklearn.ensemble import RandomForestClassifier #Picks up non-linearities

    ~/opt/anaconda3/lib/python3.9/site-packages/sklearn/__init__.py in <module>
    80 from . import _distributor_init # noqa: F401
    81 from . import __check_build # noqa: F401
    ---> 82 from .base import clone
    83 from .utils._show_versions import show_versions
    84

    ~/opt/anaconda3/lib/python3.9/site-packages/sklearn/base.py in <module>
    15 from . import __version__
    16 from ._config import get_config
    ---> 17 from .utils import _IS_32BIT
    18 from .utils._tags import (
    19 _DEFAULT_TAGS,

    ~/opt/anaconda3/lib/python3.9/site-packages/sklearn/utils/__init__.py in <module>
    20 import warnings
    21 import numpy as np
    ---> 22 from scipy.sparse import issparse
    23
    24 from .murmurhash import murmurhash3_32

    ~/opt/anaconda3/lib/python3.9/site-packages/scipy/__init__.py in <module>
    169 "(extension modules cannot be imported), " + \
    170 "please try reinstalling."
    --> 171 raise ImportError(msg) from e
    172
    173 from scipy._lib._testutils import PytestTester

    ImportError: The `scipy` install you are using seems to be broken, (extension modules cannot be imported), please try reinstalling.


    I've tried uninstalling and reinstalling scipy both as it describes in the documentation as well as using homebrew but still getting the same error.

    Does anyone have an idea how this can be resolved? Scipy was working on my machine a few weeks ago - not sure what has changed in the past weeks.

    Any help much appreciated.

    Continue reading...

Compartilhe esta Página