Skip to content

Unable to import metpy in google colab #3681

Closed

Description

@gitagiriharta

What went wrong?

Last night everything just worked perfectly fine, this morning i unable to import metpy.

Operating System

Other

Version

1.6.3

Python Version

3.10.12 (google colab)

Code to Reproduce

import metpy.calc as mpcalc

Errors, Traceback, and Logs

usr/local/lib/python3.10/dist-packages/xarray/backends/plugins.py:110: RuntimeWarning: Engine 'gini' loading failed:
cannot inherit frozen dataclass from a non-frozen one
external_backend_entrypoints = backends_dict_from_pkg(entrypoints_unique)

TypeError Traceback (most recent call last)
in <cell line: 11>()
9 obs= xr.open_mfdataset('/content/drive/MyDrive/thesis/DATA/ERA5/ERA_2016*.nc', decode_times=False) #.sel(valid_time=time).compute()
10
---> 11 import metpy.calc as mpcalc
12 #from metpy.units import units
13 #from metpy.constants import Lv, Rd, Rv, Cp_v, Cp_d, g

9 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

Activity

  1. kibidev commented on Nov 7, 2024

    @kibidev

    I had the same problem. It is causes by flexparser (imported via pint) releasing version 0.4 which will be used by default.
    Temporary workaround is to install flexparser at version 0.3.1

  2. dopplershift commented on Nov 7, 2024

    @dopplershift
    Member

    Yes, either roll back to flexparser 0.3.1 or update to the (now available) pint 0.24.4.

    Closing since there's nothing for MetPy to do here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Not A BugDescribes behavior that is working as expectedStatus: UpstreamNeeds work done in upstream projectType: BugSomething is not working like it should

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions