GAA-UAM / scikit-fda

Functional Data Analysis Python package
https://fda.readthedocs.io
BSD 3-Clause "New" or "Revised" License
308 stars 58 forks source link

TypeError: 'ABCMeta' object is not subscriptable #604

Closed buddih09 closed 3 months ago

buddih09 commented 8 months ago

Bug description summary

When I try to import skfda, the import fails with TypeError: 'ABCMeta' object is not subscriptable

Code to reproduce the bug

from skfda.ml.clustering import FuzzyCMeans
from sklearn.datasets import load_iris

if __name__ == '__main__':
    # Load iris data from scikit-learn as a pandas DataFrame
    iris = load_iris()
    df = pd.DataFrame(data=iris.data, columns=iris.feature_names)
    # Shape of the dataset (n_features, n_samples)
    df = df.to_numpy().T

    fcm = FuzzyCMeans(random_state=0)
    fcm.fit(df)

Expected result

The import should work

Actual result

Import fails

Traceback (if an exception is raised)

Traceback (most recent call last):
  File "C:\Users\buddi\PycharmProjects\cs-choice-model\test\clustering.py", line 1, in <module>
    from skfda.ml.clustering import FuzzyCMeans
  File "<frozen importlib._bootstrap>", line 1039, in _handle_fromlist
  File "C:\Conda\envs\fuzzy\lib\site-packages\lazy_loader\__init__.py", line 77, in __getattr__
    submod = importlib.import_module(submod_path)
  File "C:\Conda\envs\fuzzy\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Conda\envs\fuzzy\lib\site-packages\skfda\ml\clustering\_kmeans.py", line 17, in <module>
    from ...misc.metrics import PairwiseMetric, l2_distance
  File "<frozen importlib._bootstrap>", line 1039, in _handle_fromlist
  File "C:\Conda\envs\fuzzy\lib\site-packages\lazy_loader\__init__.py", line 77, in __getattr__
    submod = importlib.import_module(submod_path)
  File "C:\Conda\envs\fuzzy\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Conda\envs\fuzzy\lib\site-packages\skfda\misc\metrics\_utils.py", line 4, in <module>
    import multimethod
  File "C:\Conda\envs\fuzzy\lib\site-packages\multimethod\__init__.py", line 34, in <module>
    class subtype(abc.ABCMeta):
  File "C:\Conda\envs\fuzzy\lib\site-packages\multimethod\__init__.py", line 126, in subtype
    def origins(self) -> Iterator[type]:
TypeError: 'ABCMeta' object is not subscriptable

Software versions

version 0.9 windows 10

Additional context

No response

vnmabus commented 7 months ago

Sorry for not answering earlier. I couldn't reproduce the error in my computer. I notice that the exception is raised in the multimethod package, in a line that seems to have been changed in latter versions. I suggest to try with another version of the multimethod package, and report back if it works or not.

vnmabus commented 3 months ago

As I was unable to reproduce, and there is no answer from the issuer, I will assume that this was fixed when updating multimethod. Please reopen if that is not the case.