materialsproject / api

New API client for the Materials Project
https://materialsproject.github.io/api/
Other
105 stars 34 forks source link

`mp-api` fails to import `from maggma.utils import get_flat_models_from_model` #850

Closed jan-janssen closed 9 months ago

jan-janssen commented 9 months ago

There seems to be an version incompatibility between mp-api and maggma:

from mp_api.client import MPRester
  File ".../mp_api/client/__init__.py", line 7, in <module>
    from .core import MPRestError
  File ".../mp_api/client/core/__init__.py", line 3, in <module>
    from .client import BaseRester, MPRestError
  File ".../mp_api/client/core/client.py", line 31, in <module>
    from mp_api.client.core.utils import api_sanitize, validate_ids
  File ".../mp_api/client/core/utils.py", line 7, in <module>
    from maggma.utils import get_flat_models_from_model
munrojm commented 9 months ago

The latest maggma release should be compatible. I have just updated the requirement files with the correct version minimum. A patch release should be out soon once the tests pass on main.

liamhuber commented 9 months ago

The latest maggma release should be compatible. I have just updated the requirement files with the correct version minimum. A patch release should be out soon once the tests pass on main.

Would it also be possible to have this reflected in the toml file? I'm afraid I haven't used the toml system for builds so I don't know what (if any) technological side effects this would bring, but all else being equal then consistent versioning requirements across files improves readability.

munrojm commented 9 months ago

Yes, absolutely. I believe being quite loose with the dependency pinning in the toml file was done to prevent issues with the circular dependency of pymatgen and mp-api. This is now gone, so we can be more explicit. Will update and patch release now.