New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can no longer import some modules without having ASE installed #3644
Comments
Also just a comment that I would've expected this to be picked up by a linter; for me |
I noticed the same issue while trying to export XRD pattern for example here with from mp_api.client import MPRester
from pymatgen.analysis.diffraction.xrd import XRDCalculator
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
with MPRester(api_key="<enter your api key>") as mpr:
# first retrieve the relevant structure
structure = mpr.get_structure_by_material_id("mp-728693")
# important to use the conventional structure to ensure
# that peaks are labelled with the conventional Miller indices
sga = SpacegroupAnalyzer(structure)
conventional_structure = sga.get_conventional_standard_structure()
# this example shows how to obtain an XRD diffraction pattern
# these patterns are calculated on-the-fly from the structure
calculator = XRDCalculator(wavelength="CuKa")
pattern = calculator.get_pattern(conventional_structure) The Lines 25 to 34 in 57842a7
So no explicit error like |
Python version
3.11.7
Pymatgen version
2024.2.20
Operating system version
Any
Current behavior
I observed this in a fresh virtual environment when trying to install and use
mp_api
. Before #3619 (or related follow-up commits, can't tell) you were able to import the AseAtomsAdaptor without an error, even if you didn't have ASE installed. This was changed by the creation of theMSONAtoms
class which usesAtoms
via inheritance and thus is loaded at import time.Example as posted in #3619 (comment)
Expected Behavior
The module should still be importable in cases where
ase
is not available, as it was before.Minimal example
which runs correctly if you
pip install pymatgen==2024.2.8
.Relevant files to reproduce this bug
No response
The text was updated successfully, but these errors were encountered: