py4dstem / py4DSTEM

GNU General Public License v3.0
210 stars 142 forks source link

The numpy version in the installation of py4dstem-aiml #675

Open PhysXu opened 3 months ago

PhysXu commented 3 months ago

Hi, all,

I encountered an issue when installing the py4dstem with AI/ML functionality by following the steps below:

conda update conda
conda create -n py4dstem-aiml
conda activate py4dstem-aiml
conda install -c conda-forge cudatoolkit=11.0 cudnn=8.1 cupy 
pip install "py4dstem[aiml-cuda]"

The snapshot of this issue: image

and I check the version of the installed python, 4dstem and numpy, please see below: image

Is the version of numpy too high?

chiahao3 commented 1 month ago

Not from the py4DSTEM team so just my 2 cents. It's been a month since the post so you might've solve it already. I'll suggest restrict your numpy to be < 2.0 during the conda install. Numpy 2.0 was released a couple months back and it will take a while for cupy and scipy to keep up. You might need a newer python as well, probably 3.10 or 3.11. I'm suprised that conda provides a 3.9.19 to you. Overall speaking, I think you just need to find a sweet combination of python, numpy, and cupy. If you're feeling adventerous, you may experiment with different version of cudatoolkit as well.

sezelt commented 1 month ago

I tried this on my machine, and with cupy 13.3.0 and numpy 2.0.2 it is possible to import py4DSTEM. So it seems that whatever incompatibility was present has been resolved by upstream packages.

It does seem odd that py4DSTEM 0.12.8 is the version that it picks. The aiml-cuda option is still in the setup.py, so I'm not sure why newer releases don't get chosen. Is there some step in the packaging process we've been skipping? In any case, this may be the latest version where the aiml features worked, so perhaps it's intentional, but I'm still confused at what step the limit is imposed.