py4dstem / py4DSTEM

GNU General Public License v3.0
199 stars 135 forks source link

Error while loading py4DSTEM module #657

Closed subhradeep2020 closed 3 months ago

subhradeep2020 commented 3 months ago

Hi!

After installing the current version of py4dstem (tried both the conda and pip ways), I get the following error message (last line) while trying to import the module py4DSTEM at the python prompt:

ImportError: cannot import name 'check_pandas_support' from 'sklearn.utils' (C:\ProgramData\Miniconda3\envs\py4dstem\Lib\site-packages\sklearn\utils__init__.py)

Here are some details about the installation: py4DSTEM version 0.14.14 sklearn version 1.5.0 Python version 3.12.3 Windows 11, no GPU

Tried to downgrade sklearn to 1.12, deactivate/activate the environment, restart the terminal etc, but no luck.

Has anybody else encountered this issue?

Best regards and thanks! subhradeep

sezelt commented 3 months ago

As @gvarnavi found out in the linked comment, a workaround seems to be to install an older version of scikit-learn. (older than 1.5.0 perhaps)

Unfortunately, the actual source of the bug appears to be that scikit-optimize is trying to import something that's been deprecated, and since it's no longer maintained there likely isn't going to be a simple fix other than removing scikit-optimize (as we are discussing in #654 )

bsavitzky commented 3 months ago

Hi @subhradeep2020 - we've just released py4DSTEM v0.14.15 to PyPI with the fix implemented in PR #658. This should resolve the issue. If you installed using pip, if you do pip install -upgrade py4dstem it should now work. If you installed using anaconda, it may take a few hours for the updates to propagate such that the new version is available there. Once you have a chance to give it a try, could you let us know if this resolves the issue for you?

Cheers :)

subhradeep2020 commented 3 months ago

Hi @gvarnavi, I had tried to use a lower version of scikit-learn earlier, but couldn't make it work. @bsavitzky, it worked :-) Thanks a ton!!!

bsavitzky commented 3 months ago

Glad to hear @subhradeep2020 ! Thanks @gvarnavi and @smribet for the solving bugfix in #658 !