Closed JasonFurtado closed 1 year ago
Try with xESMF 0.7.0,
Also, I don't believe we've ever tested xESMF with python 3.11, so you're in uncharted territory. PRs welcome.
I switched to python 3.10. The latest version of xesmf available for python 3.10 on conda-forge is 0.6.3. Still receive the same error.
Additional note: I have xesmf package installed on my Linux server with python 3.10.8 and it works on there. On the Linux machine, I have xesmf 0.6.3, esmpy 8.2.0, and esmf 8.2.0.
(test) MacBook-Pro-7:~ jfurtado$ conda search -c conda-forge xesmf
Loading channels: done
# Name Version Build Channel
xesmf 0.1.1 py35_0 conda-forge
xesmf 0.1.1 py36_0 conda-forge
xesmf 0.1.1 py36_1 conda-forge
xesmf 0.1.1 py37_1 conda-forge
xesmf 0.1.2 py_0 conda-forge
xesmf 0.2.0 py36_0 conda-forge
xesmf 0.2.0 py37_0 conda-forge
xesmf 0.2.1 py_0 conda-forge
xesmf 0.2.2 py_0 conda-forge
xesmf 0.3.0 py_0 conda-forge
xesmf 0.4.0 pyhd8ed1ab_0 conda-forge
xesmf 0.5.0 pyhd8ed1ab_0 conda-forge
xesmf 0.5.1 pyhd8ed1ab_0 conda-forge
xesmf 0.5.2 pyhd8ed1ab_0 conda-forge
xesmf 0.5.3 pyhd8ed1ab_0 conda-forge
xesmf 0.6.0 pyhd8ed1ab_0 conda-forge
xesmf 0.6.1 pyhd8ed1ab_0 conda-forge
xesmf 0.6.2 pyhd8ed1ab_0 conda-forge
xesmf 0.6.3 pyhd8ed1ab_0 conda-forge
xesmf 0.6.3 pyhd8ed1ab_1 conda-forge
xESMF 0.7.0 was released today, it might take a few hours (or days...) to update conda-forge
. The immediate fix is to pin esmpy < 8.4
in your environment.
For what it's worth I am getting this very same error. I'm using an image built on Saturn Cloud specifying the latest pangeo requirements from here: https://github.com/pangeo-data/pangeo-docker-images/blob/master/pangeo-notebook/environment.yml This is what my built environment ended up looking like: built_enviro.txt
Building the image again, with the only difference being to specify esmpy<8.4 (per discussion above), has solved the problem for now of importing xesmf. This is the new built environment, just in case this is helpful to anyone working on this.
Have that same problem with python 3.11 and esmpy 8.4.0
Just got this issue with python 3.8.
The following steps resulted in a successfully build environment (You may be able to remove some of these steps if not needed)...
conda install -c conda-forge jupyter
conda install -c conda-forge pandas
conda install -c conda-forge numpy
conda install -c conda-forge "esmpy<8.4"
conda install -c conda-forge xesmf
got the same error with python 3.11 and xesmf 0.8.5
Hi @Aoe-sdh, can you provide more details on your error ? The exact issue of the first post here was fixed in xESMF >=0.7. I believe you might be having a different one with the same symptom. Also, could you specify which version of ESMpy you have in your environment ?
@aulemahal Hi, the ESMpy is 8.4.2 and ESMF is 8.4.2 too. The following is my error message:
Traceback (most recent call last):
File "D:\miniconda3\envs\geo_map\Lib\site-packages\esmpy\interface\loadESMF.py", line 26, in
File "<frozen os>", line 679, in __getitem__
KeyError: 'ESMFMKFILE'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\miniconda3\envs\geo_map\Lib\site-packages\xesmf\backend.py", line 22, in <module>
import esmpy as ESMF
File "D:\miniconda3\envs\geo_map\Lib\site-packages\esmpy\__init__.py", line 112, in <module>
from esmpy.api.esmpymanager import *
File "D:\miniconda3\envs\geo_map\Lib\site-packages\esmpy\api\esmpymanager.py", line 9, in <module>
from esmpy.interface.cbindings import *
File "D:\miniconda3\envs\geo_map\Lib\site-packages\esmpy\interface\cbindings.py", line 13, in <module>
from esmpy.interface.loadESMF import _ESMF
File "D:\miniconda3\envs\geo_map\Lib\site-packages\esmpy\interface\loadESMF.py", line 28, in <module>
raise ImportError('The ESMFMKFILE environment variable is not available.')
ImportError: The ESMFMKFILE environment variable is not available.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\1.Projects\002.WRF\HJ\0Code\wrfout_hj_clip.py", line 8, in <module>
import xesmf as xe
File "D:\miniconda3\envs\geo_map\Lib\site-packages\xesmf\__init__.py", line 4, in <module>
from .frontend import Regridder, SpatialAverager
File "D:\miniconda3\envs\geo_map\Lib\site-packages\xesmf\frontend.py", line 14, in <module>
from .backend import Grid, LocStream, Mesh, add_corner, esmf_regrid_build, esmf_regrid_finalize
File "D:\miniconda3\envs\geo_map\Lib\site-packages\xesmf\backend.py", line 24, in <module>
import ESMF
ModuleNotFoundError: No module named 'ESMF'
I think you are having this issue : https://github.com/pangeo-data/xESMF/issues/269 Either try to deactivate-reactivate your env, or if this doesn't work, see my comment (2nd on the linked issue) for a fix.
The bug comes from ESMF and I did push a successful fix for it in its latest version, 8.6, but they were not able to release a windows build on conda. Linux and Mac users can now install the fixed version, but not windows users who have to rely on the fixes above.
@aulemahal Hi, in my environment the esmpy and esmf version is 8.4.2, and xesmf version is 0.8.6, in the same question when I fellow the issue change the ESMFMKFILE, I get these error message:
Traceback (most recent call last): File ~.conda\envs\VPRM\Lib\site-packages\esmpy\interface\loadESMF.py:151 _ESMF = np.ctypeslib.load_library('esmf_fullylinked',libsdir) File ~.conda\envs\VPRM\Lib\site-packages\numpy\ctypeslib.py:156 in load_library return ctypes.cdll[libpath] File ~.conda\envs\VPRM\Lib\ctypes__init.py:457 in getitem return getattr(self, name) File ~.conda\envs\VPRM\Lib\ctypes\init.py:452 in getattr__ raise AttributeError(name) AttributeError: C:\Users\INTERLINK.conda\envs\VPRM\Library\lib\esmf_fullylinked.dll
During handling of the above exception, another exception occurred: Traceback (most recent call last): File ~.conda\envs\VPRM\Lib\site-packages\xesmf\util.py:8 import esmpy as ESMF File ~.conda\envs\VPRM\Lib\site-packages\esmpy__init__.py:112 from esmpy.api.esmpymanager import File ~.conda\envs\VPRM\Lib\site-packages\esmpy\api\esmpymanager.py:9 from esmpy.interface.cbindings import File ~.conda\envs\VPRM\Lib\site-packages\esmpy\interface\cbindings.py:13 from esmpy.interface.loadESMF import _ESMF File ~.conda\envs\VPRM\Lib\site-packages\esmpy\interface\loadESMF.py:157 raise ImportError('The ESMF shared library did not load properly.') ImportError: The ESMF shared library did not load properly.
During handling of the above exception, another exception occurred: Traceback (most recent call last): Cell In[4], line 32 vprm_inst.add_land_cover_map(handler_lt, save_path=veg_file, File ~.conda\envs\VPRM\Lib\site-packages\pyVPRM\VPRM.py:474 in add_land_cover_map import xesmf as xe File ~.conda\envs\VPRM\Lib\site-packages\xesmf__init__.py:3 from . import data, util File ~.conda\envs\VPRM\Lib\site-packages\xesmf\util.py:10 import ESMF ModuleNotFoundError: No module named 'ESMF'
Do you know why this error occurs?
Hi @search-0110 , really sorry but I can't see an obvious reason for that bug here. I do not work on a windows computer, so I'm not able to test this at the moment.
Instead of importing xESMF
could you try importing import esmpy
in your console instead ? If that gives a similar error, then I suggest you open an issue to the esmpy folks, here https://github.com/esmf-org/esmf. Make sure to explain that you are using the conda build of esmf/esmpy and that you did the ESMFMKFILE thing.
I am trying to work with xesmf on my Mac (MacOS Monterey v12.6.2) and I receive an error when importing xesmf. It states that it cannot find the module ESMF.
I am using python 3.11 with xesmf 0.3.0, esmf 8.4.0, and esmpy 8.4.0 installed, all from the conda-forge channel.
Sample code:
I have attached my environment as a file and copied it below.
I have tried installing a new environment and reinstalling the packages one at a time and it still gives me the same error message. Thank you in advance for your help.
environment.txt