Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import tslearn.clustering AttributeError: 'NoneType' object has no attribute 'split' #442

Open
aidenblake2 opened this issue Mar 4, 2023 · 2 comments
Labels

Comments

@aidenblake2
Copy link

aidenblake2 commented Mar 4, 2023

Describe the bug
Not able to import "TimeSeriesKMeans" from tslearn.clustering. It is resulting in following error message:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-1244b8a78c7e> in <module>
      2 import pandas as pd
      3 import matplotlib.pyplot as plt
----> 4 from tslearn.clustering import TimeSeriesKMeans
      5 from tslearn.clustering import silhouette_score

~\anaconda3\lib\site-packages\tslearn\clustering\__init__.py in <module>
      6  details.
      7 """
----> 8 from .kshape import KShape
      9 from .utils import (EmptyClusterError, silhouette_score,
     10                     TimeSeriesCentroidBasedClusteringMixin)

~\anaconda3\lib\site-packages\tslearn\clustering\kshape.py in <module>
      7 from sklearn.utils import check_array
      8 from sklearn.utils.validation import check_is_fitted
----> 9 from tslearn.preprocessing import TimeSeriesScalerMeanVariance
     10 from tslearn.utils import to_time_series_dataset, check_dims
     11 from tslearn.metrics import cdist_normalized_cc, y_shifted_sbd_vec

~\anaconda3\lib\site-packages\tslearn\preprocessing\__init__.py in <module>
      4 """
      5 
----> 6 from .preprocessing import (
      7     TimeSeriesScalerMeanVariance,
      8     TimeSeriesScalerMinMax,

~\anaconda3\lib\site-packages\tslearn\preprocessing\preprocessing.py in <module>
      6 import warnings
      7 
----> 8 from tslearn.utils import (to_time_series_dataset, check_equal_size, ts_size,
      9                            check_dims)
     10 from tslearn.bases import TimeSeriesBaseEstimator

~\anaconda3\lib\site-packages\tslearn\utils\__init__.py in <module>
      3 """
      4 
----> 5 from .utils import (
      6     check_dims,
      7     check_equal_size,

~\anaconda3\lib\site-packages\tslearn\utils\utils.py in <module>
     14 
     15 try:
---> 16     from sklearn.utils.estimator_checks import _NotAnArray as NotAnArray
     17 except ImportError:  # Old sklearn versions
     18     from sklearn.utils.estimator_checks import NotAnArray

~\anaconda3\lib\site-packages\sklearn\utils\estimator_checks.py in <module>
     16 from .. import config_context
     17 from ._param_validation import Interval
---> 18 from ._testing import _get_args
     19 from ._testing import assert_raise_message
     20 from ._testing import assert_array_equal

~\anaconda3\lib\site-packages\sklearn\utils\_testing.py in <module>
    398     fails_if_pypy = pytest.mark.xfail(IS_PYPY, reason="not compatible with PyPy")
    399     fails_if_unstable_openblas = pytest.mark.xfail(
--> 400         _in_unstable_openblas_configuration(),
    401         reason="OpenBLAS is unstable for this configuration",
    402     )

~\anaconda3\lib\site-packages\sklearn\utils\__init__.py in _in_unstable_openblas_configuration()
     88     import scipy  # noqa
     89 
---> 90     modules_info = threadpool_info()
     91 
     92     open_blas_used = any(info["internal_api"] == "openblas" for info in modules_info)

~\anaconda3\lib\site-packages\sklearn\utils\fixes.py in threadpool_info()
    148         return controller.info()
    149     else:
--> 150         return threadpoolctl.threadpool_info()
    151 
    152 

~\anaconda3\lib\site-packages\threadpoolctl.py in threadpool_info()
    122     In addition, each module may contain internal_api specific entries.
    123     """
--> 124     return _ThreadpoolInfo(user_api=_ALL_USER_APIS).todicts()
    125 
    126 

~\anaconda3\lib\site-packages\threadpoolctl.py in __init__(self, user_api, prefixes, modules)
    338 
    339             self.modules = []
--> 340             self._load_modules()
    341             self._warn_if_incompatible_openmp()
    342         else:

~\anaconda3\lib\site-packages\threadpoolctl.py in _load_modules(self)
    371             self._find_modules_with_dyld()
    372         elif sys.platform == "win32":
--> 373             self._find_modules_with_enum_process_module_ex()
    374         else:
    375             self._find_modules_with_dl_iterate_phdr()

~\anaconda3\lib\site-packages\threadpoolctl.py in _find_modules_with_enum_process_module_ex(self)
    483 
    484                 # Store the module if it is supported and selected
--> 485                 self._make_module_from_path(filepath)
    486         finally:
    487             kernel_32.CloseHandle(h_process)

~\anaconda3\lib\site-packages\threadpoolctl.py in _make_module_from_path(self, filepath)
    513             if prefix in self.prefixes or user_api in self.user_api:
    514                 module_class = globals()[module_class]
--> 515                 module = module_class(filepath, prefix, user_api, internal_api)
    516                 self.modules.append(module)
    517 

~\anaconda3\lib\site-packages\threadpoolctl.py in __init__(self, filepath, prefix, user_api, internal_api)
    604         self.internal_api = internal_api
    605         self._dynlib = ctypes.CDLL(filepath, mode=_RTLD_NOLOAD)
--> 606         self.version = self.get_version()
    607         self.num_threads = self.get_num_threads()
    608         self._get_extra_info()

~\anaconda3\lib\site-packages\threadpoolctl.py in get_version(self)
    644                              lambda: None)
    645         get_config.restype = ctypes.c_char_p
--> 646         config = get_config().split()
    647         if config[0] == b"OpenBLAS":
    648             return config[1].decode("utf-8")

AttributeError: 'NoneType' object has no attribute 'split'

To Reproduce
from tslearn.clustering import TimeSeriesKMeans

Expected behavior
import tslearn.clustering without any error message

Environment (please complete the following information):

  • OS: Windows 10
  • tslearn version 0.5.3
@aidenblake2 aidenblake2 added the bug label Mar 4, 2023
@csuxx58
Copy link

csuxx58 commented Oct 26, 2023

upgrade threadpoolctl

@kongqueyoutan
Copy link

请问如何解决,我也遇到了,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants