Open sgofferj opened 3 weeks ago
Actually, it seems, the problem is Python 3.13. After some more debugging, my application seems to run fine with latest metpy and latest xarray under Python 3.12.7
Related question: what happens if you run import pint
in the python environment where your app fails, without attempting to import MetPy or XArray? That appears three lines down from the MetPy import.
EDIT: reasoning: it looks like the problem is a conflict between pint and Python 3.13
I'll build a new bad one and test.
Yes, this is a known problem with pint on Python 3.13. I'm going to try to dig in further when I have the cycles. The only work-around right now is to use Python < 3.13.
What went wrong?
When using metpy 1.6.3 with xarray 2024.9.0, importing metpy fails
I'm building a docker container with this requirements.txt:
Until a couple of days ago, my app would work fine. It still builds fine but when I run it it fails as described below. On my desktop with xarray 2024.6.0 and metpy 1.6.2, the app runs fine.
Packages in docker container:
Operating System
Linux
Version
1.6.3
Python Version
3.13.0
Code to Reproduce
import metpy.calc as mpcalc from metpy.units import units
Errors, Traceback, and Logs
Traceback (most recent call last):
File "/app/main.py", line 2, in
File "/app/functions.py", line 5, in
File "/venv/lib/python3.13/site-packages/metpy/init.py", line 13, in
File "/venv/lib/python3.13/site-packages/metpy/xarray.py", line 31, in
File "/venv/lib/python3.13/site-packages/metpy/units.py", line 26, in
File "/venv/lib/python3.13/site-packages/pint/init.py", line 18, in
File "/venv/lib/python3.13/site-packages/pint/delegates/init.py", line 12, in
File "/venv/lib/python3.13/site-packages/pint/delegates/txt_defparser/init.py", line 12, in
File "/venv/lib/python3.13/site-packages/pint/delegates/txt_defparser/defparser.py", line 10, in
File "/venv/lib/python3.13/site-packages/pint/delegates/txt_defparser/common.py", line 23, in
File "/usr/local/lib/python3.13/dataclasses.py", line 1295, in wrap
File "/usr/local/lib/python3.13/dataclasses.py", line 1043, in _process_class
TypeError: cannot inherit frozen dataclass from a non-frozen one