Skip to content
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

circular import when importing SpaceGroup #3485

Closed
jacksund opened this issue Nov 27, 2023 · 0 comments · Fixed by #3486
Closed

circular import when importing SpaceGroup #3485

jacksund opened this issue Nov 27, 2023 · 0 comments · Fixed by #3486

Comments

@jacksund
Copy link
Contributor

@janosh It looks like the issue from #2470 was reintroduced into pymatgen v2023.11.12

To Reproduce:

from pymatgen.symmetry.groups import SpaceGroup

The traceback:

Traceback (most recent call last):

  Cell In[1], line 1
    from pymatgen.symmetry.groups import SpaceGroup

  File ~\AppData\Local\anaconda3\envs\simmate_dev\Lib\site-packages\pymatgen\symmetry\groups.py:21
    from pymatgen.core.operations import SymmOp

  File ~\AppData\Local\anaconda3\envs\simmate_dev\Lib\site-packages\pymatgen\core\__init__.py:23
    from pymatgen.core.structure import IMolecule as IMolecule

  File ~\AppData\Local\anaconda3\envs\simmate_dev\Lib\site-packages\pymatgen\core\structure.py:47
    from pymatgen.symmetry.maggroups import MagneticSpaceGroup

  File ~\AppData\Local\anaconda3\envs\simmate_dev\Lib\site-packages\pymatgen\symmetry\maggroups.py:17
    from pymatgen.symmetry.groups import SymmetryGroup, in_array_list

ImportError: cannot import name 'SymmetryGroup' from partially initialized module 'pymatgen.symmetry.groups' (most likely due to a circular import) (C:\Users\nxj625\AppData\Local\anaconda3\envs\simmate_dev\Lib\site-packages\pymatgen\symmetry\groups.py)

As an extra, this code actually works fine in case someone needs a quick-fix:

from pymatgen.symmetry import groups   # dummy import that makes others behave normally
from pymatgen.symmetry.groups import SpaceGroup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant