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

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

Open
lucyhager opened this issue Nov 7, 2024 · 2 comments

Comments

@lucyhager
Copy link

lucyhager commented Nov 7, 2024

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 dask_expr 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
Copy link
Member

I also just encountered this issue today, it seems to be related to hgrecco/pint#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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants