I have installed jupyter notebook and pymatgen in conda environment. While running the following codes on jupyter notebook I got the error mentioned below:
#########Code:##########
for item in elements:
data_youngs_modulus.append(pymat.Element(item).youngs_modulus)
#########Error##########
AttributeError Traceback (most recent call last)
Input In [12], in
28 data_CTE = []
30 for item in elements:
—> 31 data_youngs_modulus.append(pymat.Element(item).youngs_modulus)
32 data_lattice_constant.append(mendel.element(item).lattice_constant)
33 data_melting_point.append(mendel.element(item).melting_point)
AttributeError: module ‘pymatgen’ has no attribute ‘Element’
Hello,
I would guess that at the beginning of your file, you have
import pymatgen as pymat
However, typing pymat.Element only looks one level down from the top of the Pymatgen hierarchy, so it does not find Element. You will have to do something like
because now the Python interpreter will know which Element you are talking about. It might help to look up a few Pymatgen example scripts on the internet, they will show how to use imports correctly.