materialsproject / crystaltoolkit

Crystal Toolkit is a framework for building web apps for materials science and is currently powering the new Materials Project website.
https://docs.crystaltoolkit.org
Other
154 stars 59 forks source link

Cannot import name 'QQ' from 'sympy.polys.domains.rationalfield' #250

Closed thienbinh92 closed 2 years ago

thienbinh92 commented 2 years ago

Hi, I just import

import dash
from dash import html
from dash import dcc
import crystal_toolkit.components as ctc

# standard Dash imports for callbacks (interactivity)
from dash.dependencies import Input, Output, State
from dash.exceptions import PreventUpdate

from pymatgen.core.structure import Structure
from pymatgen.core.lattice import Lattice

The following error appears in my MacBook.

ImportError                               Traceback (most recent call last)
/var/folders/13/76vrjtyn2kgckfh7v76ndv900000gn/T/ipykernel_10084/1637779086.py in <module>
      2 from dash import html
      3 from dash import dcc
----> 4 import crystal_toolkit.components as ctc
      5 
      6 # standard Dash imports for callbacks (interactivity)

~/miniconda3/lib/python3.8/site-packages/crystal_toolkit/components/__init__.py in <module>
      6 crystal_toolkit_layout = MPComponent.crystal_toolkit_layout
      7 
----> 8 from crystal_toolkit.components.search import SearchComponent
      9 from crystal_toolkit.components.structure import StructureMoleculeComponent
     10 

~/miniconda3/lib/python3.8/site-packages/crystal_toolkit/components/search.py in <module>
     10 from pymatgen.core.composition import CompositionError
     11 from pymatgen.util.string import unicodeify
---> 12 from mp_api import MPRester
     13 from mp_api.client import MPRestError
     14 

~/miniconda3/lib/python3.8/site-packages/mp_api/__init__.py in <module>
      3 import os
      4 from pkg_resources import get_distribution, DistributionNotFound
----> 5 from mp_api.client import MPRester
      6 
      7 try:  # pragma: no cover

~/miniconda3/lib/python3.8/site-packages/mp_api/client.py in <module>
      6 
      7 from emmet.core.charge_density import ChgcarDataDoc
----> 8 from emmet.core.electronic_structure import BSPathType
      9 from emmet.core.mpid import MPID
     10 from emmet.core.settings import EmmetSettings

~/miniconda3/lib/python3.8/site-packages/emmet/core/electronic_structure.py in <module>
      9 import numpy as np
     10 from pydantic import BaseModel, Field
---> 11 from pymatgen.analysis.magnetism.analyzer import (
     12     CollinearMagneticStructureAnalyzer,
     13     Ordering,

~/miniconda3/lib/python3.8/site-packages/pymatgen/analysis/magnetism/__init__.py in <module>
      6 """
      7 
----> 8 from pymatgen.analysis.magnetism.analyzer import (
      9     CollinearMagneticStructureAnalyzer,
     10     MagneticStructureEnumerator,

~/miniconda3/lib/python3.8/site-packages/pymatgen/analysis/magnetism/analyzer.py in <module>
     25 from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
     26 from pymatgen.symmetry.groups import SpaceGroup
---> 27 from pymatgen.transformations.advanced_transformations import (
     28     MagOrderingTransformation,
     29     MagOrderParameterConstraint,

~/miniconda3/lib/python3.8/site-packages/pymatgen/transformations/advanced_transformations.py in <module>
     39 from pymatgen.io.ase import AseAtomsAdaptor
     40 from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
---> 41 from pymatgen.transformations.standard_transformations import (
     42     OrderDisorderedStructureTransformation,
     43     SubstitutionTransformation,

~/miniconda3/lib/python3.8/site-packages/pymatgen/transformations/standard_transformations.py in <module>
     16 
     17 from pymatgen.analysis.bond_valence import BVAnalyzer
---> 18 from pymatgen.analysis.elasticity.strain import Deformation
     19 from pymatgen.analysis.ewald import EwaldMinimizer, EwaldSummation
     20 from pymatgen.analysis.structure_matcher import StructureMatcher

~/miniconda3/lib/python3.8/site-packages/pymatgen/analysis/elasticity/__init__.py in <module>
      6 """
      7 
----> 8 from .elastic import (
      9     ComplianceTensor,
     10     ElasticTensor,

~/miniconda3/lib/python3.8/site-packages/pymatgen/analysis/elasticity/elastic.py in <module>
     12 
     13 import numpy as np
---> 14 import sympy as sp
     15 from scipy.integrate import quad
     16 from scipy.optimize import root

~/miniconda3/lib/python3.8/site-packages/sympy/__init__.py in <module>
     58 from .logic import *
     59 from .assumptions import *
---> 60 from .polys import *
     61 from .series import *
     62 from .functions import *

~/miniconda3/lib/python3.8/site-packages/sympy/polys/__init__.py in <module>
     86         FlagError)
     87 
---> 88 from .numberfields import (minpoly, minimal_polynomial, primitive_element,
     89         field_isomorphism, to_number_field, isolate)
     90 

~/miniconda3/lib/python3.8/site-packages/sympy/polys/numberfields/__init__.py in <module>
     17 from .subfield import field_isomorphism, primitive_element, to_number_field
     18 
---> 19 from .utilities import isolate
     20 
     21 from .basis import round_two

~/miniconda3/lib/python3.8/site-packages/sympy/polys/numberfields/utilities.py in <module>
      3 from sympy.core.sympify import sympify
      4 from sympy.ntheory.factor_ import factorint
----> 5 from sympy.polys.domains.rationalfield import QQ
      6 from sympy.polys.domains.integerring import ZZ
      7 from sympy.polys.matrices.exceptions import DMRankError

ImportError: cannot import name 'QQ' from 'sympy.polys.domains.rationalfield' 
mkhorton commented 2 years ago

Hi @thienbinh92, I haven't seen this before but it looks like an issue with your sympy installation, i.e. not related to Crystal Toolkit itself. If you can't get this resolved, please feel free to follow up on this issue however and I'll see if I can help.