plcrodrigues / RPA

Python code for the Riemannian Procrustes Analysis (RPA) method
BSD 3-Clause "New" or "Revised" License
47 stars 19 forks source link

Import error sklearn.cluster._kmeans #3

Closed p-vel closed 3 years ago

p-vel commented 3 years ago

Dear @plcrodrigues,

Thanks a lot for making your code available publicly (and thanks for the recent update). I found your article about RPA very interesting.

When I try to run the basic_example.py, I get an ImportError with the following report:

Traceback (most recent call last):
  File "...\RPA\examples\basic_example.py", line 6, in <module>
    from pyriemann.classification import MDM
  File "...\envs\rpa\lib\site-packages\pyriemann\__init__.py", line 6, in <module>
    from . import clustering
  File "...\envs\rpa\lib\site-packages\pyriemann\clustering.py", line 5, in <module>
    from sklearn.cluster._kmeans import _init_centroids
ImportError: cannot import name '_init_centroids' from 'sklearn.cluster._kmeans' (...\envs\rpa\lib\site-packages\sklearn\cluster\_kmeans.py

Do you have any idea how it could be fixed?

Thanks in advance !

Kind Regards,

Pierre

plcrodrigues commented 3 years ago

Hi @Pierre, thanks for your interest :-) In fact, I have just noticed that I have a strange conflict between the sklearn versions on my computer. In fact, things should work fine with scikit_learn==0.23.2 and pyriemann==0.2.6. The problem that you present comes from pyriemann and should be fixed there for recent versions of sklearn. However, its code base is kind of dead nowadays, so I guess we're stuck with sklearn 0.23.2 for now (except if you patch the library yourself) Cheers, Pedro

p-vel commented 3 years ago

Hello,

Indeed, it seems that there is a conflit between pyriemann and sklearn. I found a fix here, if someone gets the same issue: ErikBjare:dev/sklearn-0.24-fix

Kind regards,

Pierre