materialsproject / api

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

ModuleNotFoundError: No module named 'custodian' querying for task docs #757

Closed janosh closed 1 year ago

janosh commented 1 year ago
from mp_api.client import MPRester

with MPRester() as mpr:
    docs = mpr.tasks.search(task_ids=[f"mp-{idx}" for idx in range(1, 100)])

raises

      22 with MPRester(use_document_model=False) as mpr:
----> 23     docs = mpr.tasks.search(task_ids=[f"mp-{idx}" for idx in range(1, 100)])

File mp_api/client/routes/tasks.py:104, in TaskRester.search(self, task_ids, chemsys, elements, exclude_elements, formula, num_chunks, chunk_size, all_fields, fields)
    100         chemsys = [chemsys]
    102     query_params.update({"chemsys": ",".join(chemsys)})
--> 104 return super()._search(
    105     num_chunks=num_chunks,
    106     chunk_size=chunk_size,
    107     all_fields=all_fields,
    108     fields=fields,
    109     **query_params,
    110 )

File mp_api/client/core/client.py:977, in BaseRester._search(self, num_chunks, chunk_size, all_fields, fields, **kwargs)
    954 """
    955 A generic search method to retrieve documents matching specific parameters.
    956 
   (...)
    972     A list of documents.
    973 """
    974 # This method should be customized for each end point to give more user friendly,
...
--> 422 mod = __import__(modname, globals(), locals(), [classname], 0)
    423 if hasattr(mod, classname):
    424     cls_ = getattr(mod, classname)

ModuleNotFoundError: No module named 'custodian'

I tried this on 2 different machines so I don't think this is env dependent.

munrojm commented 1 year ago

Since we are choosing to not deserialize task documents by default now, this should be fixed.