Stream: general

Topic: ✔ can't import geocat


view this post on Zulip Isla Simpson (Feb 08 2023 at 00:06):

Hello, I'm trying to import geocat.comp and I'm getting an error about xarray.core.accessors. I have made a new environment so I think everything should be up to date. Attached is a screenshot of my error. Glad to hear any suggestions on how to fix this. Thanks.
Screenshot-at-2023-02-07-16-57-50.png

view this post on Zulip Anissa Zacharias (Feb 08 2023 at 00:15):

Isla, can you post the output of conda list from your activated environment?

view this post on Zulip Isla Simpson (Feb 08 2023 at 00:20):

Sure. There was a lot, so I put it in this google doc

view this post on Zulip Isla Simpson (Feb 08 2023 at 00:21):

oh wait, broken link. Try this one google doc

view this post on Zulip Deepak Cherian (Feb 08 2023 at 02:43):

The latest metpy is v1.4.0 and doesn't include that line. I would try upgrading.

view this post on Zulip Isla Simpson (Feb 08 2023 at 05:08):

Hmm, ok. Thanks. I didn't actually install metpy in my environment. I guess geocat is bringing it in as a dependency and deciding that it should be version 0.9.2? I just tried to force it to be version 1.4.0 but it's taking ages to solve the environment. I guess I'll go to bed and see if it's done in the morning!

view this post on Zulip Isla Simpson (Feb 08 2023 at 05:28):

My environment did resolve with metpy at version 1.4.0 but now I'm having problems loading xesmf. I guess maybe it was xesmf that was wanting metpy to be version 0.9.2. It looks like I'm at the latest version of xesmf (0.7.0). Any suggestions on how to get around these inconsistencies and have both geocat and xesmf working? The xesmf error is "module 'xarray.core' has no attribute 'resample'". Thanks.

view this post on Zulip Drew Camron (Feb 08 2023 at 16:23):

Can you provide the new traceback and your updated environment? Those versions of xarray, metpy, xesmf, etc. should be compatible and functional at first glance. You should not be able to install MetPy 1.4 on Python 3.7 however, so I'm suspicious that some of the mixing in of defaults here is messing up this environment.

view this post on Zulip Drew Camron (Feb 08 2023 at 16:25):

(not MetPy 0.9.2, that's quite old and I'd be super curious to see how you ended up with that at any point)

view this post on Zulip Isla Simpson (Feb 08 2023 at 16:48):

Hi Drew, I put the new output from conda list in the google doc. Attached is also the error I'm now getting. Screenshot-at-2023-02-08-09-44-43.png. It seems that I am now using python 3.10.8. In my earlier environment I had specified python 3.7 but when I updated it and specified metpy 1.4.0 I removed the specification of what python version I'm using. The following is the contents of my yml file...

channels:

- conda-forge
- defaults
- ncar
dependencies:

- python
- esmpy
- xesmf
- pandas
- xarray
- ipykernel
- scipy
- cftime
- matplotlib
- netcdf4
- dask-jobqueue
- geocat-comp
- metpy=1.4.0

Thanks!

view this post on Zulip Drew Camron (Feb 08 2023 at 16:57):

Something is limiting your version of cf-xarray, which needs updating here to be compatible with newer xarray. See if you're able to conda update cf_xarray or conda install "cf_xarray>0.7.2"

view this post on Zulip Deepak Cherian (Feb 08 2023 at 17:01):

A not-so-great but quick solution is to try import xarray.core.accessors in your notebook before import geocat . This might make it work. In the long term, an updated env is the best solution

view this post on Zulip Isla Simpson (Feb 08 2023 at 17:24):

Thanks everyone. I updated cf_xarray and now it is working to import geocat and xesmf. Not sure that I did anything to make this go wrong though. Perhaps it was the order in which I updated things.

view this post on Zulip Notification Bot (Feb 08 2023 at 17:30):

Deepak Cherian has marked this topic as resolved.


Last updated: May 16 2025 at 17:14 UTC