0

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

Grant Petty
  • 1,151
  • 1
  • 13
  • 27

1 Answers1

1

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.

DopplerShift
  • 5,472
  • 1
  • 21
  • 20
  • That solved my original problem, but now I get "module 'cartopy.feature' has no attribute 'Scaler'" when importing StationPlot. – Grant Petty Sep 28 '20 at 21:50
  • Sounds like your install of CartoPy is also out of date--`Scaler` has been in CartoPy since 0.17.0, released 2 years ago. Need to update with `conda install -c conda-forge cartopy=0.18.0`. – DopplerShift Sep 29 '20 at 01:54
  • There must be something broken in my environment, because it's refusing to advance CartoPy past 0.16.0. – Grant Petty Sep 29 '20 at 04:53
  • If you haven't put conda-forge in your default channel configuration, you could try this: `conda config --add channels conda-forge`, `conda config --set channel_priority strict`, `conda update conda`, and finally `conda update --all`. That should update settings, update Conda, and then update all your packages. – DopplerShift Sep 29 '20 at 05:12
  • Thanks for your help. Conda found a lot of package conflicts in my current environment but offered no solutions, so I'm creating a whole new environment specifically for metpy and installing required packages from scratch. Hopefully that cleans everything up. Also adding the config commands you mentioned. – Grant Petty Sep 29 '20 at 16:07