MetPy vs Pint package compatibility error

229 views Asked by At

In my Conda environment, when I run pip show MetPy, my first and last two lines are:

Name: MetPy
Version: 1.0
...
Requires: scipy, matplotlib, pandas, pyproj, pooch, importlib-resources, traitlets, importlib-metadata, numpy, pint, xarray
Required-by: 

When I run pip show pint, my first and last two lines are:

Name: Pint
Version: 0.16.1
...
Requires: packaging, importlib-metadata
Required-by: MetPy

These should be the latest versions of these packages. Yet, when I try to do...

import metpy.calc as mpcalc

...I get the following error:

Traceback (most recent call last):
  File "redacted.py", line 17, in <module>
    import metpy.calc as mpcalc
  File "~/anaconda3/envs/environment/lib/python3.7/site-packages/metpy/calc/__init__.py", line 7, in <module>
    from .cross_sections import *  # noqa: F403
  File "~/anaconda3/envs/environment/lib/python3.7/site-packages/metpy/calc/cross_sections.py", line 14, in <module>
    from .tools import first_derivative
  File "~/anaconda3/envs/environment/lib/python3.7/site-packages/metpy/calc/tools.py", line 106, in <module>
    def find_intersections(x, a, b, direction='all', log_x=False):
  File "~/anaconda3/envs/environment/lib/python3.7/site-packages/pint/registry_helpers.py", line 248, in decorator
    % (func.__name__, count_params, len(args))
TypeError: find_intersections takes 5 parameters, but 3 units were passed

This makes me think I'm missing something with my package updates. Is there another dependency I'm missing?

1

There are 1 answers

0
dcamron On

It appears likely that you might not have pip installed within your conda environment or that you are running pip from somewhere outside your conda environment, and so pip show might be misleading you. Check your versions of MetPy and Pint within your conda environment with conda list, as this should be a version conflict error between older versions of MetPy (<=0.11.1) and newer versions of Pint (>0.9).

conda install -c conda-forge metpy==1.0 should get your conda environment caught up to MetPy 1.0.