IAMconsortium / pyam

Analysis & visualization of energy & climate scenarios
https://pyam-iamc.readthedocs.io/
Apache License 2.0
236 stars 120 forks source link

TypeError: cannot inherit frozen dataclass from a non-frozen one (during import of pyam) #889

Open lucyhager opened 2 weeks ago

lucyhager commented 2 weeks ago

Hi guys,

I encountered a TypeError when trying to import pyam in my environment this morning. My installation code looks like this: _!pip install ixmp4 numpy==1.23.5 !pip install pyam-iamc numpy==1.23.5 !pip install daskexpr numpy==1.23.5 import ixmp4 import pyam

Here’s the error trace: TypeError: cannot inherit frozen dataclass from a non-frozen one

The error appears to occur within the Python dataclasses module, specifically: TypeError: cannot inherit frozen dataclass from a non-frozen one

Any guidance on resolving this or insight into potential version incompatibilities would be much appreciated.

Thank you!

...

TypeError Traceback (most recent call last) in <cell line: 5>() 3 get_ipython().system('pip install dask_expr numpy==1.23.5') 4 import ixmp4 ----> 5 import pyam

10 frames /usr/lib/python3.10/dataclasses.py in _process_class(cls, init, repr, eq, order, unsafe_hash, frozen, match_args, kw_only, slots) 988 # Raise an exception if we're frozen, but none of our bases are. 989 if not any_frozen_base and frozen: --> 990 raise TypeError('cannot inherit frozen dataclass from a ' 991 'non-frozen one') 992

TypeError: cannot inherit frozen dataclass from a non-frozen one

danielhuppmann commented 2 weeks ago

I also just encountered this issue today, it seems to be related to https://github.com/hgrecco/pint/issues/1969 (even though it's not any more only affecting Python 3.13 as of today, see the latest comments there).

For me, simply installing pint from GitHub using

pip install git+https://github.com/hgrecco/pint.git

worked as a quickfix. Hoping that a new pint version will be released asap.

lucyhager commented 2 weeks ago

Great, that seemed to do the trick, thanks @danielhuppmann !