Validation error importing MPRester, maybe to do with EmmetSettings

How do I troubleshoot this error? I have never used the API before.

ValidationError                           Traceback (most recent call last)
Cell In[3], line 1
----> 1 from mp_api.client import MPRester

File ~\AppData\Roaming\Python\Python311\site-packages\mp_api\client\__init__.py:7
      4 import os
      5 from importlib.metadata import PackageNotFoundError, version
----> 7 from .core import MPRestError
      8 from .mprester import MPRester
     10 try:

File ~\AppData\Roaming\Python\Python311\site-packages\mp_api\client\core\__init__.py:3
      1 from __future__ import annotations
----> 3 from .client import BaseRester, MPRestError, MPRestWarning
      4 from .settings import MAPIClientSettings

File ~\AppData\Roaming\Python\Python311\site-packages\mp_api\client\core\client.py:26
     24 import requests
     25 from bson import json_util
---> 26 from emmet.core.utils import jsanitize
     27 from monty.json import MontyDecoder
     28 from pydantic import BaseModel, create_model

File ~\AppData\Roaming\Python\Python311\site-packages\emmet\core\utils.py:46
     41     from collections.abc import Mapping
     43     from emmet.core.typing import PathLike
---> 46 SETTINGS = EmmetSettings()
     49 def get_sg(struc, symprec=SETTINGS.SYMPREC) -> int:
     50     """helper function to get spacegroup with a loose tolerance"""

File C:\ProgramData\anaconda3\Lib\site-packages\pydantic_settings\main.py:167, in BaseSettings.__init__(__pydantic_self__, _case_sensitive, _nested_model_default_partial_update, _env_prefix, _env_file, _env_file_encoding, _env_ignore_empty, _env_nested_delimiter, _env_parse_none_str, _env_parse_enums, _cli_prog_name, _cli_parse_args, _cli_settings_source, _cli_parse_none_str, _cli_hide_none_type, _cli_avoid_json, _cli_enforce_required, _cli_use_class_docs_for_groups, _cli_exit_on_error, _cli_prefix, _cli_flag_prefix_char, _cli_implicit_flags, _cli_ignore_unknown_args, _secrets_dir, **values)
    139 def __init__(
    140     __pydantic_self__,
    141     _case_sensitive: bool | None = None,
   (...)
    165 ) -> None:
    166     # Uses something other than `self` the first arg to allow "self" as a settable attribute
--> 167     super().__init__(
    168         **__pydantic_self__._settings_build_values(
    169             values,
    170             _case_sensitive=_case_sensitive,
    171             _nested_model_default_partial_update=_nested_model_default_partial_update,
    172             _env_prefix=_env_prefix,
    173             _env_file=_env_file,
    174             _env_file_encoding=_env_file_encoding,
    175             _env_ignore_empty=_env_ignore_empty,
    176             _env_nested_delimiter=_env_nested_delimiter,
    177             _env_parse_none_str=_env_parse_none_str,
    178             _env_parse_enums=_env_parse_enums,
    179             _cli_prog_name=_cli_prog_name,
    180             _cli_parse_args=_cli_parse_args,
    181             _cli_settings_source=_cli_settings_source,
    182             _cli_parse_none_str=_cli_parse_none_str,
    183             _cli_hide_none_type=_cli_hide_none_type,
    184             _cli_avoid_json=_cli_avoid_json,
    185             _cli_enforce_required=_cli_enforce_required,
    186             _cli_use_class_docs_for_groups=_cli_use_class_docs_for_groups,
    187             _cli_exit_on_error=_cli_exit_on_error,
    188             _cli_prefix=_cli_prefix,
    189             _cli_flag_prefix_char=_cli_flag_prefix_char,
    190             _cli_implicit_flags=_cli_implicit_flags,
    191             _cli_ignore_unknown_args=_cli_ignore_unknown_args,
    192             _secrets_dir=_secrets_dir,
    193         )
    194     )

File C:\ProgramData\anaconda3\Lib\site-packages\pydantic\main.py:214, in BaseModel.__init__(self, **data)
    212 # `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks
    213 __tracebackhide__ = True
--> 214 validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
    215 if self is not validated_self:
    216     warnings.warn(
    217         'A custom validator is returning a value other than `self`.\n'
    218         "Returning anything other than `self` from a top level model validator isn't supported when validating via `__init__`.\n"
    219         'See the `model_validator` docs (https://docs.pydantic.dev/latest/concepts/validators/#model-validators) for more details.',
    220         stacklevel=2,
    221     )

ValidationError: 23 validation errors for EmmetSettings
VASP_DEFAULT_INPUT_SETS.GGA Structure Optimization
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPRelaxSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.GGA+U Structure Optimization
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPRelaxSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.r2SCAN Structure Optimization
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPScanRelaxSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.SCAN Structure Optimization
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPScanRelaxSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.PBEsol Structure Optimization
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPScanRelaxSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.GGA Static
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPStaticSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.GGA+U Static
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPStaticSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.r2SCAN Static
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPScanStaticSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.SCAN Static
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPScanStaticSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.PBEsol Static
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPScanStaticSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.HSE06 Static
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPScanStaticSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.GGA NSCF Uniform
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPNonSCFSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.GGA+U NSCF Uniform
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPNonSCFSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.GGA NSCF Line
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPNonSCFSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.GGA+U NSCF Line
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPNonSCFSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.GGA NMR Electric Field Gradient
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPNMRSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.GGA NMR Nuclear Shielding
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPNMRSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.GGA+U NMR Electric Field Gradient
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPNMRSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.GGA+U NMR Nuclear Shielding
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPNMRSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.GGA Deformation
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPStaticSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.GGA+U Deformation
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPStaticSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.GGA DFPT Dielectric
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPStaticSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error
VASP_DEFAULT_INPUT_SETS.GGA+U DFPT Dielectric
  Value error, numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject [type=value_error, input_value='pymatgen.io.vasp.sets.MPStaticSet', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/value_error

It’ll be hard for us to pinpoint the issue without a code snippet indicating the specific code you’re trying to execute. From what I can glance from the traceback, the following line suggests that you’re running the code with a numpy installation/version different from the one you used when installing emmet-core.

Value error, numpy.dtype size changed, may indicate binary incompatibility.

The code I’m trying to run is

from mp_api.client import MPRester

Just that one line.

I have no idea when emmet_core was installed, presumably when I did pip install mp_api earlier today? The numpy installation would be older.

Do I need to uninstall emmet_core and reinstall it?

Try to set up your python dependencies in a new and dedicated conda environment.

This eventually worked. I think something else besides emmet-core had an issue, but the fresh environment with just numpy, mp_api, and dependencies installed worked.