Skip to content

mpr.materials.grain_boundaries throws: ModuleNotFoundError: No module named 'pymatgen.analysis.gb' #991

@DanielYang59

Description

@DanielYang59

Env:

  • Python 3.13.5, mp_api 0.45.7, MacOS 15.5

The following code:

from mp_api.client import MPRester

with MPRester() as mpr:
    gb_docs = mpr.materials.grain_boundaries.search(
        chemsys="Fe",
        sigma=5,
        rotation_axis=["0 0 1"]
    )

Gives:

Traceback (most recent call last):
  File "/Users/yang/developer/pymatgen/test_gb_download.py", line 4, in <module>
    gb_docs = mpr.materials.grain_boundaries.search(
        chemsys="Fe",
        sigma=5,
        rotation_axis=["0 0 1"]
    )
  File "/Users/yang/developer/pymatgen/.venv/lib/python3.13/site-packages/mp_api/client/routes/materials/grain_boundaries.py", line 109, in search
    return super()._search(
           ~~~~~~~~~~~~~~~^
        num_chunks=num_chunks,
        ^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        **query_params,
        ^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/yang/developer/pymatgen/.venv/lib/python3.13/site-packages/mp_api/client/core/client.py", line 1191, in _search
    return self._get_all_documents(
           ~~~~~~~~~~~~~~~~~~~~~~~^
        kwargs,
        ^^^^^^^
    ...<3 lines>...
        num_chunks=num_chunks,
        ^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/yang/developer/pymatgen/.venv/lib/python3.13/site-packages/mp_api/client/core/client.py", line 1264, in _get_all_documents
    results = self._query_resource(
        query_params,
    ...<3 lines>...
        num_chunks=num_chunks,
    )
  File "/Users/yang/developer/pymatgen/.venv/lib/python3.13/site-packages/mp_api/client/core/client.py", line 570, in _query_resource
    data = self._submit_requests(
        url=url,
    ...<5 lines>...
        timeout=timeout,
    )
  File "/Users/yang/developer/pymatgen/.venv/lib/python3.13/site-packages/mp_api/client/core/client.py", line 717, in _submit_requests
    initial_data_tuples = self._multi_thread(
        self._submit_request_and_process, initial_params_list
    )
  File "/Users/yang/developer/pymatgen/.venv/lib/python3.13/site-packages/mp_api/client/core/client.py", line 939, in _multi_thread
    data, subtotal = future.result()
                     ~~~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ~~~~~~~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/opt/homebrew/Cellar/python@3.13/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/yang/developer/pymatgen/.venv/lib/python3.13/site-packages/mp_api/client/core/client.py", line 1038, in _submit_request_and_process
    raise MPRestError(
    ...<2 lines>...
    )
mp_api.client.core.client.MPRestError: REST query returned with error status code 500 on URL https://api.materialsproject.org/materials/grain_boundaries/?rotation_axis=0+0+1&sigma=5&_all_fields=True&chemsys=Fe&_limit=1000 with message:
Response Internal Server Error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions