My goal is to use PyCDT: Python Charged Defect Toolkit (paper, github, pypi). I installed the code by doing:

pip3 install pycdt

I am not using any virtual environment. The OS is Ubuntu 22.04.3 LTS. Python version: 3.10.12, pip version: 23.3.2.


After installing the code, when I ran it, it gives the following error:

$ pycdt
Traceback (most recent call last):
  File "/usr/local/bin/pycdt", line 4, in <module>
    __import__('pkg_resources').run_script('pycdt==2.0.5', 'pycdt')
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 656, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1453, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python3.10/dist-packages/pycdt-2.0.5-py3.10.egg/EGG-INFO/scripts/pycdt", line 37, in <module>
    from pymatgen.analysis.defects.thermodynamics import DefectPhaseDiagram
ModuleNotFoundError: No module named 'pymatgen.analysis.defects'

Attempt at solution

I have searched at the PyCDT forum without success and also they are inactive in the forum for more than one and a half-year. I have tried installing it from the GitHub and their BitBucket repo. After the seemingly successful installation, when I am running it, it throws an error saying:

pkg_resources.DistributionNotFound: The 'pymatgen==2020.6.8' distribution was not found and is required by pycdt

When trying to install that specific version of pymatgen, pip throws error saying error: metadata-generation-failed


1 Answer 1


They break backwards compatibility all the time! I have run into different but equally frustrating problems before. It seems your problem may have solutions. See here: https://materialsproject.github.io/pymatgen-analysis-defects/intro.html


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .