New issues with materialsvirtuallab notebook and cohesive energy


For my research I am often looking for cohesive energies of compound, which I need to interrogate the API for. In the past I simply launch a notebook using:

I then just modify something for my own purpose and it has always worked fine:

from pymatgen.ext.matproj import MPRester
mpr = MPRester(“insert my ID”)
mpr.get_cohesive_energy(‘mp-6124’, per_atom=True)

Now for some reason as of yesterday I get this issue for cohesive energy

Does anyone know why all of sudden this isn’t working?:

TypeError Traceback (most recent call last)
1 # Querying by formula only.
----> 3 mpr.get_cohesive_energy(‘mp-6124’, per_atom=True)

/srv/conda/envs/notebook/lib/python3.7/site-packages/pymatgen/ext/ in get_cohesive_energy(self, material_id, per_atom)
1310 Cohesive energy (eV).
1311 “”"
→ 1312 entry = self.get_entry_by_material_id(material_id)
1313 ebulk = / entry.composition.get_integer_formula_and_factor()[1]
1314 comp_dict = entry.composition.reduced_composition.as_dict()

/srv/conda/envs/notebook/lib/python3.7/site-packages/pymatgen/ext/ in get_entry_by_material_id(self, material_id, compatible_only, inc_structure, property_data, conventional_unit_cell)
747 inc_structure=inc_structure,
748 property_data=property_data,
→ 749 conventional_unit_cell=conventional_unit_cell,
750 )
751 return data[0]

/srv/conda/envs/notebook/lib/python3.7/site-packages/pymatgen/ext/ in get_entries(self, chemsys_formula_id_criteria, compatible_only, inc_structure, property_data, conventional_unit_cell, sort_by_e_above_hull)
563 with warnings.catch_warnings():
564 warnings.filterwarnings(“ignore”, message=“Failed to guess oxidation states.*”)
→ 565 entries = MaterialsProject2020Compatibility().process_entries(entries, clean=True)
566 if sort_by_e_above_hull:
567 entries = sorted(entries, key=lambda entry:[“e_above_hull”])

/srv/conda/envs/notebook/lib/python3.7/site-packages/pymatgen/entries/ in process_entries(self, entries, clean, verbose)
557 processed_entry_list = []
→ 559 for entry in PBar(entries, disable=(not verbose)):
560 ignore_entry = False
561 # if clean is True, remove all previous adjustments from the entry

/srv/conda/envs/notebook/lib/python3.7/site-packages/pymatgen/util/ in init(self, total, **kwargs)
36 = total
37 self.done = 0
—> 38
40 def update(self, amount):

/srv/conda/envs/notebook/lib/python3.7/site-packages/pymatgen/util/ in report(self)
52 Print progress.
53 “”"
—> 54 print("{} of {} done {:.1%}".format(self.done,, self.done /

TypeError: unsupported operand type(s) for /: ‘int’ and ‘list’

I was able to recreate the bug, but only using a notebook running in the matgenb binder hub. I was able to fix the problem by installing the tqdm package, which is used for progress bars:

pip install tqdm

You can run this in terminal, or in Jupyter by using an exclamation point, i.e. !pip install tqdm

Let me know if this works for you?