Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError when importing metpy.calc #1305

Closed
avatar101 opened this issue Jan 17, 2020 · 4 comments
Closed

TypeError when importing metpy.calc #1305

avatar101 opened this issue Jan 17, 2020 · 4 comments
Labels
Area: Units Pertains to unit information Status: Not A Bug Describes behavior that is working as expected

Comments

@avatar101
Copy link

  • Problem description: Error while importing metpy.calc module
# Your code here
import metpy as mp
import metpy.calc as mpcalc

TypeError Traceback (most recent call last)
in
----> 1 import metpy.calc as mpcalc

~/.conda/envs/work_env_mali/lib/python3.7/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

~/.conda/envs/work_env_mali/lib/python3.7/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

~/.conda/envs/work_env_mali/lib/python3.7/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

~/.conda/envs/work_env_mali/lib/python3.7/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


  • Which platform: Linux

    • python --version Python 3.7.4

    • conda list | grep metpy
      metpy 0.11.0 py37_0 conda-forge
      *conda version : 4.7.12

@avatar101 avatar101 added the Type: Bug Something is not working like it should label Jan 17, 2020
@avatar101
Copy link
Author

avatar101 commented Jan 20, 2020

I have another machine with python 3.7.4 and metpy 0.10.2 and it is also reporting the same error.
Update: I have created another environment with metpy v 0.12 and that fixed the error. For some dependency reason, conda doesn't update metpy to the latest version in my original work environment.

@dopplershift
Copy link
Member

Sounds like in those other environments, it’s pulling in a new version of pint (0.10.x), which is causing the problems. I expect MetPy 0.12 is the only one to work with that version of pint.

MetPy 0.12 bumped required versions of some dependencies. That may be why it won’t automatically update.

At any rate, given that the latest version of MetPy works, and the breakage seems to be induced but the latest Pint, I don’t see anything for us to fix in MetPy so I’m closing. Feel free to re-open if you think there’s something I’m missing.

@dopplershift dopplershift added Area: Units Pertains to unit information Status: Not A Bug Describes behavior that is working as expected and removed Type: Bug Something is not working like it should labels Jan 26, 2020
@allenea
Copy link

allenea commented Jun 4, 2020

Hi Ryan,

Any idea what the conflict may be? It's not that important.

To run:
https://unidata.github.io/python-gallery/examples/Hovmoller_Diagram.html

To anyone with future problems.... I needed to:
conda create --name py37 python=3.7
conda install -c conda-forge metpy
conda install -c anaconda netcdf4
conda install -c conda-forge pydap
python test_hovmoller.py

@dopplershift
Copy link
Member

@allenea Did conda install -c conda-forge netcdf4 not work? I get a little queasy when conda-forge gets mixed with other channels. I'd actually just add conda-forge to your default channels and use it entirely:

conda config --set channel_priority strict
conda config --add channels conda-forge
conda install metpy netcdf4 pydap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Units Pertains to unit information Status: Not A Bug Describes behavior that is working as expected
Projects
None yet
Development

No branches or pull requests

3 participants