abinit / abipy

Open-source library for analyzing the results produced by ABINIT
http://abinit.github.io/abipy
Other
117 stars 96 forks source link

ImportError when using abicheck.py with abipy and pymatgen #262

Closed emayMTK closed 1 year ago

emayMTK commented 1 year ago

I'm encountering an issue when trying to use abicheck.py with the abipy and pymatgen libraries in my abienv conda environment. Here's the command I'm running and the error I'm facing:

Command:

(abienv) mtk@mtk-HP-EliteBook-x360-1030-G2:~/abipy$ abicheck.py --with-flow Error :

/home/mtk/miniconda3/envs/abienv/bin/abicheck.py:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  __import__('pkg_resources').run_script('abipy==0.9.3', 'abicheck.py')
Traceback (most recent call last):
  File "/home/mtk/miniconda3/envs/abienv/bin/abicheck.py", line 4, in <module>
    __import__('pkg_resources').run_script('abipy==0.9.3', 'abicheck.py')
  File "/home/mtk/miniconda3/envs/abienv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 722, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/home/mtk/miniconda3/envs/abienv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1561, in run_script
    exec(code, namespace, namespace)
  File "/home/mtk/miniconda3/envs/abienv/lib/python3.9/site-packages/abipy-0.9.3-py3.9.egg/EGG-INFO/scripts/abicheck.py", line 11, in <module>
    import abipy.flowtk as flowtk
  File "/home/mtk/miniconda3/envs/abienv/lib/python3.9/site-packages/abipy-0.9.3-py3.9.egg/abipy/flowtk/__init__.py", line 15, in <module>
    from .tasks import *
  File "/home/mtk/miniconda3/envs/abienv/lib/python3.9/site-packages/abipy-0.9.3-py3.9.egg/abipy/flowtk/tasks.py", line 36, in <module>
    from .abitimer import AbinitTimerParser
  File "/home/mtk/miniconda3/envs/abienv/lib/python3.9/site-packages/abipy-0.9.3-py3.9.egg/abipy/flowtk/abitimer.py", line 2, in <module>
    from pymatgen.io.abinit.abitimer import AbinitTimerParserError, AbinitTimerParser, AbinitTimerSection
ImportError: cannot import name 'AbinitTimerParserError' from 'pymatgen.io.abinit.abitimer' (/home/mtk/miniconda3/envs/abienv/lib/python3.9/site-packages/pymatgen/io/abinit/abitimer.py)

It seems that the AbinitTimerParserError class is not being imported from the pymatgen.io.abinit.abitimer module, causing the ImportError. I have already checked that both abipy and pymatgen are installed in my abienv environment.

I have tried updating both abipy and pymatgen using conda update, but the issue persists. I'm using Python 3.9.

Any suggestions on how to resolve this issue would be greatly appreciated. Thank you in advance for your help!

mbercx commented 1 year ago

This is a duplicate of #261, related to this change: https://github.com/materialsproject/pymatgen/commit/5b88fc181d8ab97a7d1d3c47692cefdf673888c5, released in pymatgen v2023.7.11.