aiidalab / aiidalab-docker-stack

Docker images with the basic software stack for AiiDAlab
https://aiidalab.net
Other
9 stars 14 forks source link

Pymatgen installed via aiida-core[atomic_tools] does not work in full-stack image #320

Closed danielhollas closed 1 year ago

danielhollas commented 2 years ago

Try installing aiida-core[atomic_tools] in the new aiidalab/full-stack

pip install aiida-core[atomic_tools]

(that's what happens when I install aiida-orca plugin as a dependency in my AiiDAlab app).

Then try the following import (taken from AWB)

>>> from pymatgen.core import Structure, Molecule
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/lib/python3.9/site-packages/pymatgen/core/__init__.py", line 20, in <module>
    from .lattice import Lattice  # noqa
  File "/opt/conda/lib/python3.9/site-packages/pymatgen/core/lattice.py", line 22, in <module>
    from pymatgen.util.coord import pbc_shortest_vectors
  File "/opt/conda/lib/python3.9/site-packages/pymatgen/util/coord.py", line 17, in <module>
    from . import coord_cython as cuc
  File "pymatgen/util/coord_cython.pyx", line 1, in init pymatgen.util.coord_cython
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
unkcpz commented 2 years ago

Will update numpy to 1.21 manually solve the problem?

danielhollas commented 2 years ago

One problem might be that numpy is installed via conda from conda-forge (I guess as part of AiiDA dependencies) while pymatgen gets installed via pip in my case. Reinstalling numpy via pip seems to solve the issue.

pip install -U numpy
unkcpz commented 2 years ago

Thanks for checking, @danielhollas. aiida-core pinned the numpy version to 1.19. I think that's is the cause of the issue when installing the pymatgen from aiida-core[atomic_tools]. Could you open an issue to the aiida-core? Bumping the numpy version solve the issue, but may bring other problem to other dependencies.

danielhollas commented 1 year ago

@unkcpz I just noticed this line in the setup.cfg in the aiidalab-qe repo

    numpy~=1.23 # pined for pymatgen

I guess that above error might be the reason for this?

unkcpz commented 1 year ago

This no more an issue after we clear the dependencies of the AWB. The issue happened since the numpy version installed from app is different from the one by docker stack (1.23).