Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: pydantic 2.10.0 breaks mp-api #941

Closed
1 of 3 tasks
SiLiKhon opened this issue Nov 21, 2024 · 6 comments
Closed
1 of 3 tasks

[Bug]: pydantic 2.10.0 breaks mp-api #941

SiLiKhon opened this issue Nov 21, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@SiLiKhon
Copy link

Code snippet

### on google colab: 
# !pip uninstall -y pydantic pydantic_core
# !pip install mp-api  # observe that pydantic-2.10.0 gets installed

from mp_api.client import MPRester

with MPRester("...") as mpr:
    docs = mpr.materials.summary.search(material_ids=["mp-950995"])

What happened?

  1. install mp-api in a clean environment
  2. for some reason, pydantic 2.10.0 gets installed as a dependency
  3. broken mp-api

Version

0.42.2

Which OS?

  • MacOS
  • Windows
  • Linux

Log output

/usr/local/lib/python3.10/dist-packages/mp_api/client/core/client.py in _generate_returned_model(self, doc)
   1073         )
   1074 
-> 1075         data_model.model_fields = {
   1076             **{
   1077                 name: description

AttributeError: can't set attribute 'model_fields'
@SiLiKhon SiLiKhon added the bug Something isn't working label Nov 21, 2024
@saj3sh
Copy link

saj3sh commented Nov 21, 2024

i am also getting same issue

@SiLiKhon
Copy link
Author

Note: downgrading back to pydantic==2.9.2 should fix the issue (at least, with mp-api==0.42.2)

@PythonFZ
Copy link

Can replicate as well

@tschaume
Copy link
Member

@SiLiKhon @saj3sh @PythonFZ I just pushed a release candidate to PyPI: https://pypi.org/project/mp-api/0.43.0rc1/. Give it a try and let me know if you notice any issues. Thanks!

@SiLiKhon
Copy link
Author

Thanks @tschaume !
I tried !pip install mp-api==0.43.0rc1 on colab, and it works fine with both new pydantic 2.10.0 and 2.10.1.

@tschaume
Copy link
Member

Thanks @SiLiKhon. I just pushed out a new release v0.43.0 (same as v0.43.0rc1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants