command line utility of pymatgen

511 Views Asked by At

I have installed the python package pymatgen and it perfectly works when I use it in my Jupyter notebooks. However, now I wanted to do the POSCAR setup as specified here: https://pymatgen.org/installation.html But when I run: pmg config -p <EXTRACTED_VASP_POTCAR> <MY_PSP> (with my directories) in my command line (Linux), it can't find it and I get the error:

Command 'pmg' not found, did you mean:

  command 'mg' from deb mg
  command 'pmc' from deb linuxptp
  command 'pig' from deb bsdgames
  command 'pmi' from deb powermanagement-interface
  command 'pmw' from deb pmw
  command 'vmg' from deb vmg
  command 'pms' from deb pms
  command 'pm' from deb powerman
  command 'peg' from deb peg

EDIT: I found the file "pmg", it looks as follows:

#!/home/ramfrey/anaconda3/bin/python

# -*- coding: utf-8 -*-
import re
import sys

from pymatgen.cli.pmg import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

If I run python pmg I get the error:

Traceback (most recent call last):
  File "pmg", line 7, in <module>
    from pymatgen.cli.pmg import main
ImportError: No module named pymatgen.cli.pmg

But this exact module "pymatgen.cli.pmg" I can import in my jupyter notebook without a problem. And I still don't really get it, as in the installation guide, it says that one should directly run "pmg config…"

1

There are 1 best solutions below

0
On BEST ANSWER

The issue was indeed that I was using the wrong python version to run the pmg-script (It was a work computer with many different python versions and I was using python 3.7.6 but there was an old python 2.7 set as default which was used when jus ran "python pmg"). I ran conda activate base in my /home/username/anaconda3 and then python pmg etc. and it worked.