Skip to main content
Topic: [Python] Error using scipy (Read 653 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[Python] Error using scipy

I am using sklearn/scipy and I think something here still needs a rebuild.
command:
Code: [Select]
# Aufteilen der Daten in Trainings- und Testdaten
from sklearn.model_selection import train_test_split

X_train, X_test, y_train, y_test = train_test_split(X, y,
                                                    test_size=0.2,
                                                    random_state=42,
                                                    shuffle=True)
This is the error I get:
Code: [Select]
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/tmp/ipykernel_28589/3170307533.py in <module>
      1 # Aufteilen der Daten in Trainings- und Testdaten
----> 2 from sklearn.model_selection import train_test_split
      3
      4 X_train, X_test, y_train, y_test = train_test_split(X, y,
      5                                                     test_size=0.2,

/usr/lib/python3.10/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

/usr/lib/python3.10/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,

/usr/lib/python3.10/site-packages/sklearn/utils/__init__.py in <module>
     26 from ..exceptions import DataConversionWarning
     27 from .deprecation import deprecated
---> 28 from .fixes import np_version, parse_version
     29 from ._estimator_html_repr import estimator_html_repr
     30 from .validation import (

/usr/lib/python3.10/site-packages/sklearn/utils/fixes.py in <module>
     18 import scipy.sparse as sp
     19 import scipy
---> 20 import scipy.stats
     21 from scipy.sparse.linalg import lsqr as sparse_lsqr  # noqa
     22 import threadpoolctl

/usr/lib/python3.10/site-packages/scipy/stats/__init__.py in <module>
    439
    440
--> 441 from .stats import *
    442 from .distributions import *
    443 from .morestats import *

/usr/lib/python3.10/site-packages/scipy/stats/stats.py in <module>
     35 from numpy import array, asarray, ma
     36
---> 37 from scipy.spatial.distance import cdist
     38 from scipy.ndimage import measurements
     39 from scipy._lib._util import (check_random_state, MapWrapper,

/usr/lib/python3.10/site-packages/scipy/spatial/__init__.py in <module>
    100 from ._plotutils import *
    101 from ._procrustes import procrustes
--> 102 from ._geometric_slerp import geometric_slerp
    103
    104 __all__ = [s for s in dir() if not s.startswith('_')]

/usr/lib/python3.10/site-packages/scipy/spatial/_geometric_slerp.py in <module>
      6
      7 import numpy as np
----> 8 from scipy.spatial.distance import euclidean
      9
     10

/usr/lib/python3.10/site-packages/scipy/spatial/distance.py in <module>
    119 from scipy._lib.deprecation import _deprecated
    120
--> 121 from . import _distance_wrap
    122 from . import _hausdorff
    123 from ..linalg import norm

ImportError: /usr/lib/python3.10/site-packages/scipy/spatial/_distance_wrap.cpython-310-x86_64-linux-gnu.so: undefined symbol: npy_copysign

Would be appreciated if someone could verify this error or if something in the dependencies of scipy/sklearn needs rebuilding.

Re: [Python] Error using scipy

Reply #1
Rebuilding locally scipy and sklearn fixed the import failure.
I just pushed a rebuild of those two, keep me up to date when it propagates.

 

Re: [Python] Error using scipy

Reply #2
Updates have propagated to me and the error is now fixed, thanks.