From mp_api.client import MPRester error

!pip3 install mp-api ------ successfully installed

when running the following command
from mp_api.client import MPRester getting the following error


AttributeError Traceback (most recent call last)

/usr/local/lib/python3.7/dist-packages/pkg_resources/init.py in _dep_map(self)
3015 try:
→ 3016 return self.__dep_map
3017 except AttributeError:

16 frames

/usr/local/lib/python3.7/dist-packages/pkg_resources/init.py in getattr(self, attr)
2812 if attr.startswith(‘_’):
→ 2813 raise AttributeError(attr)
2814 return getattr(self._provider, attr)

AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last)

/usr/local/lib/python3.7/dist-packages/pkg_resources/init.py in _parsed_pkg_info(self)
3006 try:
→ 3007 return self._pkg_info
3008 except AttributeError:

/usr/local/lib/python3.7/dist-packages/pkg_resources/init.py in getattr(self, attr)
2812 if attr.startswith(‘_’):
→ 2813 raise AttributeError(attr)
2814 return getattr(self._provider, attr)

AttributeError: _pkg_info

During handling of the above exception, another exception occurred:

FileNotFoundError Traceback (most recent call last)

in
----> 1 from mp_api.client import MPRester

/usr/local/lib/python3.7/dist-packages/mp_api/init.py in
4 from monty.serialization import loadfn
5 from pkg_resources import get_distribution, DistributionNotFound
----> 6 from mp_api.client import MPRester
7
8 try:

/usr/local/lib/python3.7/dist-packages/mp_api/client.py in
6 from typing_extensions import Literal
7
----> 8 from emmet.core.mpid import MPID
9 from emmet.core.settings import EmmetSettings
10 from emmet.core.symmetry import CrystalSystem

/usr/local/lib/python3.7/dist-packages/emmet/core/init.py in
10
11 try:
—> 12 version = get_distribution(“emmet-core”).version
13 except DistributionNotFound: # pragma: no cover
14 # package is not installed

/usr/local/lib/python3.7/dist-packages/pkg_resources/init.py in get_distribution(dist)
464 dist = Requirement.parse(dist)
465 if isinstance(dist, Requirement):
→ 466 dist = get_provider(dist)
467 if not isinstance(dist, Distribution):
468 raise TypeError(“Expected string, Requirement, or Distribution”, dist)

/usr/local/lib/python3.7/dist-packages/pkg_resources/init.py in get_provider(moduleOrReq)
340 “”“Return an IResourceProvider for the named module or requirement”“”
341 if isinstance(moduleOrReq, Requirement):
→ 342 return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
343 try:
344 module = sys.modules[moduleOrReq]

/usr/local/lib/python3.7/dist-packages/pkg_resources/init.py in require(self, *requirements)
884 included, even if they were already activated in this working set.
885 “”"
→ 886 needed = self.resolve(parse_requirements(requirements))
887
888 for dist in needed:

/usr/local/lib/python3.7/dist-packages/pkg_resources/init.py in resolve(self, requirements, env, installer, replace_conflicting, extras)
778
779 # push the new requirements onto the stack
→ 780 new_requirements = dist.requires(req.extras)[::-1]
781 requirements.extend(new_requirements)
782

/usr/local/lib/python3.7/dist-packages/pkg_resources/init.py in requires(self, extras)
2732 def requires(self, extras=()):
2733 “”“List of Requirements needed for this distro if extras are used”“”
→ 2734 dm = self._dep_map
2735 deps = []
2736 deps.extend(dm.get(None, ()))

/usr/local/lib/python3.7/dist-packages/pkg_resources/init.py in _dep_map(self)
3016 return self.__dep_map
3017 except AttributeError:
→ 3018 self.__dep_map = self._compute_dependencies()
3019 return self.__dep_map
3020

/usr/local/lib/python3.7/dist-packages/pkg_resources/init.py in _compute_dependencies(self)
3025 reqs = []
3026 # Including any condition expressions
→ 3027 for req in self._parsed_pkg_info.get_all(‘Requires-Dist’) or []:
3028 reqs.extend(parse_requirements(req))
3029

/usr/local/lib/python3.7/dist-packages/pkg_resources/init.py in _parsed_pkg_info(self)
3007 return self._pkg_info
3008 except AttributeError:
→ 3009 metadata = self.get_metadata(self.PKG_INFO)
3010 self._pkg_info = email.parser.Parser().parsestr(metadata)
3011 return self._pkg_info

/usr/local/lib/python3.7/dist-packages/pkg_resources/init.py in get_metadata(self, name)
1405 return “”
1406 path = self._get_metadata_path(name)
→ 1407 value = self._get(path)
1408 try:
1409 return value.decode(‘utf-8’)

/usr/local/lib/python3.7/dist-packages/pkg_resources/init.py in _get(self, path)
1609
1610 def _get(self, path):
→ 1611 with open(path, ‘rb’) as stream:
1612 return stream.read()
1613

FileNotFoundError: [Errno 2] No such file or directory: ‘/usr/local/lib/python3.7/dist-packages/urllib3-1.24.3.dist-info/METADATA’

Hi @Jameer,

Looks like you are using Python 3.7. We don’t currently support that version officially. If possible, I would upgrade to at least 3.8. If you must use 3.7, there is a deprecated git branch (with not everything functional) called py37 you can install from and try.

– Jason

Dear munrojm,

Yes, or try using installing from the py37 branch on github.

– Jason