Background
When using ASE version 3.23, an Import Error occurs when importing FixSymmetry.
Workaround
If you are using notation prior to version 3.22, please modify it to the notation used in version 3.23 or use notation that is compatible with both versions.
Notation prior to version 3.22
from ase.spacegroup.symmetrize import FixSymmetry
Notation for version 3.23
from ase.constraints import FixSymmetry
Notation compatible with both version 3.22 and 3.23
try:
from ase.constraints import FixSymmetry
except ImportError:
from ase.spacegroup.symmetrize import FixSymmetry
Reason
In ASE 3.23, FixSymmetry has been moved to ase.constraints.
The method that is compatible with both versions 3.22 and 3.23 is set up as follows:
- Attempt to import FixSymmetry from ase.constraints.
- If it fails (if ASE is version 3.22 or earlier), import from ase.spacegroup.symmetrize.
Reference
Relevant GitHub pages:
- Old version 3.22.1 (FixSymmetry present in ase/spacegroup/symmetrize.py)
https://gitlab.com/ase/ase/-/blob/3.22.1/ase/spacegroup/symmetrize.py?ref_type=tags - New version 3.23.0 (FixSymmetry not present in ase/spacegroup/symmetrize.py)
https://gitlab.com/ase/ase/-/blob/3.22.1/ase/spacegroup/symmetrize.py?ref_type=tags - New version 3.23.0 (FixSymmetry present in ase/constraints.py)
https://gitlab.com/ase/ase/-/blob/master/ase/constraints.py?ref_type=heads#L2290