Upgrading packages like Matlantis CSP (mtcsp) can break your pymatgen environment due to breaking changes introduced in pymatgen v2026.2.24 and later. (Note: mtcsp supports pymatgen v2026.x from version v1.4.1 onwards.)
Situation:
The February 2026 update split pymatgen's core features into a separate package called pymatgen-core(Official Change log: v2026.2.24; see also the Pro-Tip below). This architectural shift can cause conflicts between stale download caches and outdated dependency trees, potentially leading to import failures across various pymatgen modules.
Example Errors:
ModuleNotFoundError: No module named 'pymatgen.core.graphs'
ModuleNotFoundError: No module named 'pymatgen.io.ase'
ModuleNotFoundError: No module named 'pymatgen.core.composition'
ModuleNotFoundError: No module named 'pymatgen.analysis.phase_diagram'
How to Fix:
Run the following command wipe the outdated cache and force a clean reinstall of pymatgen and its dependencies. We highly recommend restarting your kernel after running this command.
%pip install --force-reinstall --no-cache-dir pymatgen
Pro-Tip:
Since pymatgen's core features were split into the separate pymatgen-core package, you can now pinpoint and import only the specific classes you need. This significantly reduces memory usage during MTCSP search/exploration tasks. (Applicable to mtcsp v1.4.1 and later)
Reference:
- pymatgen Changelog
https://pymatgen.org/CHANGES.html - pymatgen GitHub Releases
https://github.com/materialsproject/pymatgen/releases