I installed metpy with pip in order to plot a skewT diagram. I have the following issue when I try to import metpy packages:
File "/home/straussc/Documents/stage2A/observations/programmes/trace_skewT.py", line 10, in <module>
import metpy.calc as mpcalc
File "/home/straussc/.local/lib/python3.10/site-packages/metpy/__init__.py", line 15, in <module>
from .xarray import * # noqa: F401, F403, E402
File "/home/straussc/.local/lib/python3.10/site-packages/metpy/xarray.py", line 31, in <module>
from .units import (_mutate_arguments, DimensionalityError, is_quantity, UndefinedUnitError,
File "/home/straussc/.local/lib/python3.10/site-packages/metpy/units.py", line 26, in <module>
import pint
File "/home/straussc/.local/lib/python3.10/site-packages/pint/__init__.py", line 28, in <module>
from .formatting import formatter, register_unit_format
File "/home/straussc/.local/lib/python3.10/site-packages/pint/formatting.py", line 20, in <module>
from .babel_names import _babel_lengths, _babel_units
File "/home/straussc/.local/lib/python3.10/site-packages/pint/babel_names.py", line 11, in <module>
from .compat import HAS_BABEL
File "/home/straussc/.local/lib/python3.10/site-packages/pint/compat.py", line 34, in <module>
from typing_extensions import Self # noqa
ImportError: cannot import name 'Self' from 'typing_extensions' (/usr/lib/python3/dist-packages/typing_extensions.py)
Does someone understand where it comes from?
typing_extensionsin your environment is outdated and in conflict with newer installs ofpint, the units library MetPy relies on. Update the outdated package withand you should be good to go. There is an open issue to prevent this from happening in the future.