Ошибка импорта SciKit-learn из-за возможной проблемы Scipy ⇐ Python

Программы на Python
Anonymous
Ошибка импорта SciKit-learn из-за возможной проблемы Scipy

Сообщение Anonymous »

Для простоты

Код: Выделить всё

import sklearn
Я получаю следующую ошибку и не знаю, как ее исправить.

Код: Выделить всё

{
"name": "TypeError",
"message": "C function scipy.linalg._cythonized_array_utils.__pyx_fuse_0swap_c_and_f_layout has wrong signature (expected void (float *, float *, int, int, int), got void (float *, float *, int, int))",
"stack": "---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/var/folders/6g/kczfnvwx61n0pyjkk9swlgrm0000gn/T/ipykernel_44026/1232488958.py in 
----> 1 import sklearn
2 print(sklearn.__version__)

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/__init__.py in 
82         _distributor_init,  # noqa: F401
83     )
---> 84     from .base import clone
85     from .utils._show_versions import show_versions
86

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/base.py in 
17 from ._config import config_context, get_config
18 from .exceptions import InconsistentVersionWarning
---> 19 from .utils._estimator_html_repr import _HTMLDocumentationLinkMixin, estimator_html_repr
20 from .utils._metadata_requests import _MetadataRequester, _routing_enabled
21 from .utils._param_validation import validate_parameter_constraints

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/utils/__init__.py in 
9 from . import _joblib, metadata_routing
10 from ._bunch import Bunch
---> 11 from ._chunking import gen_batches, gen_even_slices
12 from ._estimator_html_repr import estimator_html_repr
13

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/utils/_chunking.py in 
6
7 from .._config import get_config
----> 8 from ._param_validation import Interval, validate_params
9
10

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/utils/_param_validation.py in 
9
10 import numpy as np
---> 11 from scipy.sparse import csr_matrix, issparse
12
13 from .._config import config_context, get_config

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/scipy/sparse/__init__.py in 
306
307 # For backward compatibility with v0.19.
--> 308 from .  import csgraph
309
310 # Deprecated namespaces, to be removed in v2.0.0

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/scipy/sparse/csgraph/__init__.py in 
183            'NegativeCycleError']
184
--> 185 from ._laplacian import laplacian
186 from ._shortest_path import (
187     shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson,

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/scipy/sparse/csgraph/_laplacian.py in 
5 import numpy as np
6 from scipy.sparse import issparse
----> 7 from scipy.sparse.linalg import LinearOperator
8 from scipy.sparse._sputils import convert_pydata_sparse_to_scipy, is_pydata_spmatrix
9

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/scipy/sparse/linalg/__init__.py in 
127 \"\"\"
128
--> 129 from ._isolve import *
130 from ._dsolve import *
131 from ._interface import *

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/scipy/sparse/linalg/_isolve/__init__.py in 
4 from .iterative import *
5 from .minres import minres
----> 6 from .lgmres import lgmres
7 from .lsqr import lsqr
8 from .lsmr import lsmr

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/scipy/sparse/linalg/_isolve/lgmres.py in 
4 import numpy as np
5 from numpy.linalg import LinAlgError
----> 6 from scipy.linalg import get_blas_funcs
7 from .iterative import _get_atol_rtol
8 from .utils import make_system

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/scipy/linalg/__init__.py in 
213 from ._decomp_schur import *
214 from ._decomp_polar import *
--> 215 from ._matfuncs import *
216 from .blas import *
217 from .lapack import *

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/scipy/linalg/_matfuncs.py in 
16 from ._expm_frechet import expm_frechet, expm_cond
17 from ._matfuncs_sqrtm import sqrtm
---> 18 from ._matfuncs_expm import pick_pade_structure, pade_UV_calc
19
20 # deprecated imports to be removed in SciPy 1.13.0

_matfuncs_expm.pyx in init scipy.linalg._matfuncs_expm()

TypeError: C function scipy.linalg._cythonized_array_utils.__pyx_fuse_0swap_c_and_f_layout has wrong signature (expected void (float *, float *, int, int, int), got void (float *, float *, int, int))"
}
Я пробовал удалить и установить sklearn, numpy и scipy

Подробнее здесь: https://stackoverflow.com/questions/790 ... cipy-issue

Вернуться в «Python»