Search code examples
metpy

Why do I get this error when importing MetPy submodules?


I just installed MetPy for the first time using

conda install -c conda-forge metpy

under Mac OS X 10.14 (Mojave). I appear to have gotten metpy-0.11.1

The following line then generates the error diagnotics copied at the bottom.

from metpy.plots import StationPlot

I get the exact same error (TypeError: find_intersections takes 5 parameters, but 3 units were passed) if I instead try

import metpy.calc as mpcalc

I don't get an error if I import the entire module using

import metpy

I have never before experienced an import error with any established Python package, so any help debugging my setup would be appreciated.

TypeError Traceback (most recent call last) in ----> 1 from metpy.plots import StationPlot 2

~/miniconda3/envs/scipy/lib/python3.6/site-packages/metpy/plots/init.py in 11 from .ctables import * # noqa: F403 12 from .declarative import * # noqa: F403 ---> 13 from .skewt import * # noqa: F403 14 from .station_plot import * # noqa: F403 15 from .wx_symbols import * # noqa: F403

~/miniconda3/envs/scipy/lib/python3.6/site-packages/metpy/plots/skewt.py in 27 28 from ._util import colored_line ---> 29 from ..calc import dewpoint, dry_lapse, moist_lapse, vapor_pressure 30 from ..calc.tools import _delete_masked_points 31 from ..deprecation import metpyDeprecation

~/miniconda3/envs/scipy/lib/python3.6/site-packages/metpy/calc/init.py in 5 6 from .basic import * # noqa: F403 ----> 7 from .cross_sections import * # noqa: F403 8 from .indices import * # noqa: F403 9 from .kinematics import * # noqa: F403

~/miniconda3/envs/scipy/lib/python3.6/site-packages/metpy/calc/cross_sections.py in 12 13 from .basic import coriolis_parameter ---> 14 from .tools import first_derivative 15 from ..package_tools import Exporter 16 from ..xarray import check_axis, check_matching_coordinates

~/miniconda3/envs/scipy/lib/python3.6/site-packages/metpy/calc/tools.py in 104 @preprocess_xarray 105 @units.wraps(('=A', '=B'), ('=A', '=B', '=B')) --> 106 def find_intersections(x, a, b, direction='all', log_x=False): 107 """Calculate the best estimate of intersection. 108

~/miniconda3/envs/scipy/lib/python3.6/site-packages/pint/registry_helpers.py in decorator(func) 246 raise TypeError( 247 "%s takes %i parameters, but %i units were passed" --> 248 % (func.name, count_params, len(args)) 249 ) 250

TypeError: find_intersections takes 5 parameters, but 3 units were passed


Solution

  • My guess is that you have too recent a version of Pint installed (>= 0.10) for that older version of MetPy. I'd update at least metpy with conda install -c conda-forge metpy=0.12.2. You can try updating everything with conda update -c conda-forge --all.