abinit / abipy

Open-source library for analyzing the results produced by ABINIT

Home Page:http://abinit.github.io/abipy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pinning the pymatgen version?

unkcpz opened this issue · comments

Install the package directly will install pymatgen==2023.7.14 since the version is not pinned.

I got:

ValueError: Error occurred validating port 'inputs.metadata.options.parser_name': invalid parser specified: Failed to load entry point 'opsp.pseudo.oncv':                                                                                 
Traceback (most recent call last):                                                                                                                                                                                                         
  File "/opt/conda/lib/python3.9/site-packages/aiida/plugins/entry_point.py", line 237, in load_entry_point                                                                                                                                
    loaded_entry_point = entry_point.load()                                                                          
  File "/opt/conda/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 207, in load                                                                                                                                          
    module = import_module(match.group('module'))                                                                                                                                                                                          
  File "/opt/conda/lib/python3.9/importlib/__init__.py", line 127, in import_module                                                                                                                                                        
    return _bootstrap._gcd_import(name[level:], package, level)                                                                                                                                                                            
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import                                                                                                                                                                          
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load                                                                                                                                                                       
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked                                                                                                                                                               
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked                                                                                                                                                                        
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module                                                                                                                                                                  
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed                                                                                                                                                             
  File "/home/aiida/aiida-opsp/aiida_opsp/parser.py", line 8, in <module>                                                                                                                                                                  
    from abipy.ppcodes.oncv_parser import OncvParser                                                                                                                                                                                       
  File "/opt/conda/lib/python3.9/site-packages/abipy/__init__.py", line 18, in <module>                                                                                                                                                    
    from abipy.core import release                                                                                                                                                                                                         
  File "/opt/conda/lib/python3.9/site-packages/abipy/core/__init__.py", line 4, in <module>                                                                                                                                                
    from .structure import *                                                                                                                                                                                                               
  File "/opt/conda/lib/python3.9/site-packages/abipy/core/structure.py", line 27, in <module>                                                                                                                                              
    from abipy.flowtk import PseudoTable                                                                                                                                                                                                   
  File "/opt/conda/lib/python3.9/site-packages/abipy/flowtk/__init__.py", line 15, in <module>                                                                                                                                             
    from .tasks import *                                                                                                                                                                                                                   
  File "/opt/conda/lib/python3.9/site-packages/abipy/flowtk/tasks.py", line 37, in <module>                                                                                                                                                
    from .abitimer import AbinitTimerParser                                                                                                                                                                                                
  File "/opt/conda/lib/python3.9/site-packages/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' (/opt/conda/lib/python3.9/site-packages/pymatgen/io/abinit/abitimer.py)   

This is related to the following change:

materialsproject/pymatgen@5b88fc1

In the latest abipy version the import has been updated to fix this:

# flake8: noqa
#from pymatgen.io.abinit.abitimer import AbinitTimerParserError, AbinitTimerParser, AbinitTimerSection
from pymatgen.io.abinit.abitimer import AbinitTimerParseError, AbinitTimerParser, AbinitTimerSection

But if your environment still uses an older pymatgen version due to other package dependency restrictions, this will fail again, so I suggest an import based on the pymatgen version.

Pinning the pymatgen version is also not a good idea for this reason. I think if everyone starts pinning their pymatgen versions we're going to run into dependency resolution conflicts.

Thanks @mbercx, I think I have to not pinning pymatgen, but this means if they change the API in the future again, things break.

In the latest abipy version the import has been updated to fix this:

Yes, @gmatteo told me so. I'll close this.

Thanks @mbercx, I think I have to not pinning pymatgen, but this means if they change the API in the future again, things break.

Yeah, I know... But if we pin it every package that uses it in the common workflows will have to pin it to the same version, else we can't install aiida-common-workflows at all. We could define a range and update the upper limit from time to time?