cosimoNigro / agnpy

Modelling jetted Active Galactic Nuclei radiative processes with python
https://agnpy.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
45 stars 32 forks source link

Incompatibility between astropy 5.0.1 and agnpy 0.1.8 ? #116

Open garciagenrique opened 2 years ago

garciagenrique commented 2 years ago

Hi, I found and error when installing agnpy from pip, that brings the latests version of astropy (v0.5.1).

When importing agnpy it raises the following error (see below). I downgrade astropy to 4.2 and agnpy can be imported correctly.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/opt/conda/lib/python3.8/site-packages/astropy/units/_typing.py in <module>
      8 try:  # py 3.9+
----> 9     from typing import Annotated
     10 except (ImportError, ModuleNotFoundError):  # optional dependency

ImportError: cannot import name 'Annotated' from 'typing' (/opt/conda/lib/python3.8/typing.py)

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
<ipython-input-1-4024036b86cf> in <module>
----> 1 import agnpy

/opt/conda/lib/python3.8/site-packages/agnpy/__init__.py in <module>
----> 1 from .spectra import *
      2 from .emission_regions import *
      3 from .targets import *
      4 from .synchrotron import *
      5 from .compton import *

/opt/conda/lib/python3.8/site-packages/agnpy/spectra/__init__.py in <module>
----> 1 from .spectra import *

/opt/conda/lib/python3.8/site-packages/agnpy/spectra/spectra.py in <module>
      1 # module containing the electron spectra
      2 import numpy as np
----> 3 import astropy.units as u
      4 from ..utils.math import trapz_loglog
      5 from ..utils.conversion import mec2

/opt/conda/lib/python3.8/site-packages/astropy/units/__init__.py in <module>
     38 
     39 from .structured import *
---> 40 from .decorators import *
     41 
     42 del bases

/opt/conda/lib/python3.8/site-packages/astropy/units/decorators.py in <module>
     11 import numpy as np
     12 
---> 13 from . import _typing as T
     14 from .core import (Unit, UnitBase, UnitsError,
     15                    add_enabled_equivalencies, dimensionless_unscaled)

/opt/conda/lib/python3.8/site-packages/astropy/units/_typing.py in <module>
     16 
     17     else:
---> 18         from typing_extensions import *  # override typing
     19 
     20 HAS_ANNOTATED = Annotated is not NotImplemented

AttributeError: module 'typing_extensions' has no attribute 'OrderedDictTypedDict'
cosimoNigro commented 2 years ago

Thanks @garciagenrique, I will look into it.