Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
165 views
in Technique[技术] by (71.8m points)

python - MetPy vs Pint package compatibility error

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?

question from:https://stackoverflow.com/questions/65909788/metpy-vs-pint-package-compatibility-error

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...