api icon indicating copy to clipboard operation
api copied to clipboard

PkgResourcesDeprecationWarning: -PKG-VERSION is an invalid version and will not be supported in a future release

Open maungthway opened this issue 3 years ago • 1 comments

I tried to import MPRester using this commend and get the following warning. Is there a way to fix this warning?

Code: from mp_api.client import MPRester

Warning: C:\ProgramData\Anaconda3\envs\mp_newapi\lib\site-packages\pkg_resources_init_.py:123: PkgResourcesDeprecationWarning: -PKG-VERSION is an invalid version and will not be supported in a future release warnings.warn(

maungthway avatar Oct 12 '22 08:10 maungthway

This causes a hard crash now for us in pyiron.[1] Please advice on a possible fix, I guess in the short term we can downgrade setuptools.

We are using versions pymatgen==2022.11.7, mp-api==0.30.5 and setuptools==66.0.0.

Full backtrace

   File "/u/zora/software/pyiron_atomistics/pyiron_atomistics/atomistics/structure/factories/materialsproject.py", line 2, in <module>
     from mp_api.client import MPRester
   File "/u/zora/.local/lib/python3.8/site-packages/mp_api/client/__init__.py", line 13, in <module>
     __version__ = get_distribution(__package__).version
   File "/u/system/SLES12/soft/pyiron/dev/anaconda3/lib/python3.8/site-packages/pkg_resources/__init__.py", line 514, in get_distribution
     dist = get_provider(dist)
   File "/u/system/SLES12/soft/pyiron/dev/anaconda3/lib/python3.8/site-packages/pkg_resources/__init__.py", line 386, in get_provider
     return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
   File "/u/system/SLES12/soft/pyiron/dev/anaconda3/lib/python3.8/site-packages/pkg_resources/__init__.py", line 956, in require
     needed = self.resolve(parse_requirements(requirements))
   File "/u/system/SLES12/soft/pyiron/dev/anaconda3/lib/python3.8/site-packages/pkg_resources/__init__.py", line 815, in resolve
     dist = self._resolve_dist(
   File "/u/system/SLES12/soft/pyiron/dev/anaconda3/lib/python3.8/site-packages/pkg_resources/__init__.py", line 844, in _resolve_dist
     env = Environment(self.entries)
   File "/u/system/SLES12/soft/pyiron/dev/anaconda3/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1044, in __init__
     self.scan(search_path)
   File "/u/system/SLES12/soft/pyiron/dev/anaconda3/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1077, in scan
     self.add(dist)
   File "/u/system/SLES12/soft/pyiron/dev/anaconda3/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1096, in add
     dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
   File "/u/system/SLES12/soft/pyiron/dev/anaconda3/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2631, in hashcmp
     self.parsed_version,
   File "/u/system/SLES12/soft/pyiron/dev/anaconda3/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2678, in parsed_version
     self._parsed_version = parse_version(self.version)
   File "/u/system/SLES12/soft/pyiron/dev/anaconda3/lib/python3.8/site-packages/pkg_resources/_vendor/packaging/version.py", line 266, in __init__
     raise InvalidVersion(f"Invalid version: '{version}'")
 pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: 'NOT-A-GIT-REPOSITORY'

pmrv avatar Jan 18 '23 12:01 pmrv