Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module 'pymatgen.io.abinit.netcdf' has no attribute 'ETSF_Reader' #274

Open
abdelghany0 opened this issue Oct 4, 2023 · 3 comments
Open

Comments

@abdelghany0
Copy link

Dear Abipy Developers,

I faced this issue with the Yambopy code but it looks like an Abipy issue.

When I run the script python gw_bn.py the following error shows up:

Traceback (most recent call last):
  File "/rhome/Ragab/11-yambopy/3run/plot-qp.py", line 53, in <module>
    ks_bs, qp_bs = ydb.interpolate(lat,path,what='QP+KS',lpratio=20)
  File "/usr/local/anaconda3/envs/triqs/lib/python3.9/site-packages/yambopy-0.2.0-py3.9.egg/yambopy/dbs/qpdb.py", line 275, in interpolate
    from abipy.core.skw import SkwInterpolator
  File "/usr/local/anaconda3/envs/triqs/lib/python3.9/site-packages/abipy/__init__.py", line 17, in <module>
    from abipy.core import release
  File "/usr/local/anaconda3/envs/triqs/lib/python3.9/site-packages/abipy/core/__init__.py", line 3, in <module>
    from .kpoints import *
  File "/usr/local/anaconda3/envs/triqs/lib/python3.9/site-packages/abipy/core/kpoints.py", line 19, in <module>
    from abipy.iotools import ETSF_Reader
  File "/usr/local/anaconda3/envs/triqs/lib/python3.9/site-packages/abipy/iotools/__init__.py", line 17, in <module>
    class ETSF_Reader(ionc.ETSF_Reader):
AttributeError: module 'pymatgen.io.abinit.netcdf' has no attribute 'ETSF_Reader'

How can I solve this issue?

Thanks

Ragab

@sphuber
Copy link
Contributor

sphuber commented Oct 6, 2023

This was reported here #258 and should be fixed by d172fb8

@abdelghany0
Copy link
Author

@sphuber
Thank you for your reply,
The problem was solved by following the issue you indicated. But I ran into another issue:

File "/usr/local/anaconda3/envs/triqs/lib/python3.9/gzip.py", line 173, in __init__
    fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/anaconda3/envs/triqs/lib/python3.9/site-packages/pymatgen/io/vasp/potcar_summary_stats.json.gz'

I think it is related to Bugs listed here, but I don't know how to solve it.

Do you have any tips on dealing with this problem?

@sphuber
Copy link
Contributor

sphuber commented Oct 18, 2023

That depends on what triggered the exception. You only show the last part of the stack trace.

The problem is that the pymatgen.io.vasp module relies on this potcar_summary_stats.json.gz file being there, but it isn't. The problem was that abipy was always importing this module, and so always excepting, even if you are not using that part.

Therefore, in e3d3776 I simply moved the imports to inside the methods where they are used. After that, you can use abipy again. It is on the develop branch, so just check that out and install it.

Of course, if you then actually import the pymatgen module, that will still probably except because it cannot find the .json.gz file. But that is a bug with pymatgen I would say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants