Failed to set vasp functional type


I was trying to get 4 vasp input files(INCAR, POSCAR, POTCAR, KPOINTS) by material project id. The default functional in potcar is PBE, but I am using GGA, so I set PMG_DEFAULT_FUNCTIONAL to PW91, but it didn’t work.
My code as below

from pymatgen.ext.matproj import MPRester
from import MPRelaxSet

import os

APIkey = 'XXXXXXXXXX'  # update the key when necessary
mpr = MPRester(APIkey)
os.system('pmg config --add PMG_VASP_PSP_DIR G:/pseudo-potential/potpaw_GGA')
os.system('pmg config --add PMG_DEFAULT_FUNCTIONAL PW91')

structure = mpr.get_structure_by_material_id('mp-1')
relaxed_structure = MPRelaxSet(structure)

After running this, I got error message:

  File "C:/Users/binxi/Desktop/vaspInputFilesGen/", line 14, in <module>
  File "G:\anaconda\lib\site-packages\pymatgen\io\vasp\", line 476, in write_input
  File "G:\anaconda\lib\site-packages\pymatgen\io\vasp\", line 164, in write_input
    vinput = self.get_vasp_input()
  File "G:\anaconda\lib\site-packages\pymatgen\io\vasp\", line 149, in get_vasp_input
  File "G:\anaconda\lib\site-packages\pymatgen\io\vasp\", line 124, in potcar
    return Potcar(self.potcar_symbols, functional=self.potcar_functional)
  File "G:\anaconda\lib\site-packages\pymatgen\io\vasp\", line 1733, in __init__
    self.set_symbols(symbols, functional, sym_potcar_map)
  File "G:\anaconda\lib\site-packages\pymatgen\io\vasp\", line 1824, in set_symbols
    p = PotcarSingle.from_symbol_and_functional(el, functional)
  File "G:\anaconda\lib\site-packages\pymatgen\io\vasp\", line 1610, in from_symbol_and_functional
OSError: You do not have the right POTCAR with functional PBE and label Cs_sv in your VASP_PSP_DIR 

In last line, it says ‘with functional PBE’, but I already set it to ‘PW91’.

Anyone can help?

Please ask pymatgen questions on the pymatgen discourse page: