Stream: general

Topic: xesmf issue when using NPL-2023b


view this post on Zulip Hui Li (Nov 16 2023 at 23:19):

I was trying to use xesmf to regrid CAM SE to FV grid within the NPL-2023 kernel and got the following error:

"File /glade/u/apps/opt/conda/envs/npl-2023b/lib/python3.10/site-packages/xesmf/backend.py:24
21 try:
22 import esmpy as ESMF
23 except ImportError:
-> 24 import ESMF
ModuleNotFoundError: No module named 'ESMF'"

Has anyone had this issue before?

view this post on Zulip Katelyn FitzGerald (Nov 17 2023 at 00:43):

@Hui Li what machine are you working on? I was able to get xesmf to at least import on casper and cheyenne in that env. It looks like something might be off with your environment variables.

view this post on Zulip Hui Li (Nov 17 2023 at 01:14):

@Katelyn FitzGerald I am on Casper. I was able to import xesmf and construct the regridder and everything with no problem, until the regridder starts to run. My code mainly follows the blog post here. The code before the issue is as follows:

regridder = xesmf.Regridder(
dummy_in,
dummy_out,
weights=weight_file,
method="bilinear",
reuse_weights=True,
periodic=True,
)
regridded = regridder(updated.rename({"dummy": "lat", "ncol": "lon"}))
regridded.compute()

I am also using Casper and can comfirm that the problem occurs with the "regrid" task stream.

view this post on Zulip Katie Dagon (Nov 17 2023 at 18:28):

Hey @Hui Li I have seen something similar before that ended up being linked to the version of esmf and esmpy installed in my environment. I had to downgrade to version 8.2.0 for both to resolve the issue. Digging a little further, it looks like the issue I was having has since been resolved with esmf version 8.5.0, while the npl-2023b environment is still using 8.4.2. This would be a great issue to open in the ncar-conda repo to request the newer version, and in the meantime you could try your own environment with the updated packages to see if that works.

view this post on Zulip Katelyn FitzGerald (Nov 17 2023 at 18:42):

You might also check to see if you have other modules or things loaded that might be messing with your environment variables (I'm not seeing the same problem, but just have the default modules loaded and am using the NPL-2023b conda env). Some of the HPC focused CISL staff might have more specific suggestions and certainly a better understanding of how things are configured.

view this post on Zulip Hui Li (Nov 17 2023 at 18:49):

Thanks @Katie Dagon ! this is SUPER helpful! I was able to bypass the import error last night and have been stuck with that ESMFMKFILE location issue, which seems to be solved in the latest version. I'll try upgrading the package to see if that works. Will report back and open an issue to the ncar repo.

view this post on Zulip Hui Li (Nov 17 2023 at 19:26):

Hmm.. I am having trouble finding version 8.5.0 with conda. It seems like the latest esmpy available in conda-forge is the version 8.4.2 (https://anaconda.org/conda-forge/esmpy). Am I missing something?

view this post on Zulip Katie Dagon (Nov 17 2023 at 19:52):

Hmm I'm not sure. It does look like there are releases on github for esmf 8.5.0 and 8.6.0, and the docs say that it should be on conda-forge. Bill Sacks could be a good person to reach out to!

view this post on Zulip Katelyn FitzGerald (Nov 17 2023 at 20:43):

It looks like they're struggling with some build issues over on the feedstock repository and that's been holding up the releases: https://github.com/conda-forge/esmf-feedstock/pull/109

view this post on Zulip Katelyn FitzGerald (Nov 17 2023 at 20:46):

I'd still reach out to the ESMF group and/or on GitHub, but for a near term solution - you might try downgrading the version.


Last updated: May 16 2025 at 17:14 UTC