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

Import Error with ESMPy 8.0.0 on Mac due to mixed conda channels #28

Closed
JiaweiZhuang opened this issue Nov 16, 2019 · 0 comments
Closed

Comments

@JiaweiZhuang
Copy link
Member

I got the classic ImportError: The ESMF shared library did not load properly and image not found with importing esmpy 8.0.0 on Mac. I've fixed the problem via JiaweiZhuang/xESMF#54 (comment) and conda-forge Tips & tricks. Basically, add this block to my $HOME/.condarc:

channel_priority: strict
channels:
  - conda-forge
  - defaults

This is probably not a bug. Just post the issue here for reference. I didn't run into this problem with esmpy<=7.1.0. Not sure why esmpy 8.0.0 needs such a fix.

The install command:

conda create -n esmpy python=3.6  # same problem for 3.7
conda activate esmpy
conda install -c conda-forge esmpy=8.0.0

The error without strictly forcing conda-forge channels.

>>> import ESMF
Traceback (most recent call last):
  File "/Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/python3.6/site-packages/ESMF/interface/loadESMF.py", line 125, in <module>
    _ESMF = np.ctypeslib.load_library('libesmf_fullylinked',libsdir)
  File "/Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/python3.6/site-packages/numpy/ctypeslib.py", line 152, in load_library
    return ctypes.cdll[libpath]
  File "/Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/python3.6/ctypes/__init__.py", line 423, in __getitem__
    return getattr(self, name)
  File "/Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/python3.6/ctypes/__init__.py", line 418, in __getattr__
    dll = self._dlltype(name)
  File "/Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/libesmf_fullylinked.dylib, 6): Library not loaded: @rpath/libmpifort.12.dylib
  Referenced from: /Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/libesmf_fullylinked.dylib
  Reason: image not found
Traceback (most recent call last):
  File "/Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/python3.6/site-packages/ESMF/interface/loadESMF.py", line 125, in <module>
    _ESMF = np.ctypeslib.load_library('libesmf_fullylinked',libsdir)
  File "/Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/python3.6/site-packages/numpy/ctypeslib.py", line 152, in load_library
    return ctypes.cdll[libpath]
  File "/Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/python3.6/ctypes/__init__.py", line 423, in __getitem__
    return getattr(self, name)
  File "/Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/python3.6/ctypes/__init__.py", line 418, in __getattr__
    dll = self._dlltype(name)
  File "/Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/libesmf_fullylinked.dylib, 6): Library not loaded: @rpath/libmpifort.12.dylib
  Referenced from: /Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/libesmf_fullylinked.dylib
  Reason: image not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/python3.6/site-packages/ESMF/__init__.py", line 70, in <module>
    from ESMF.api.esmpymanager import *
  File "/Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/python3.6/site-packages/ESMF/api/esmpymanager.py", line 11, in <module>
    from ESMF.interface.cbindings import *
  File "/Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/python3.6/site-packages/ESMF/interface/cbindings.py", line 13, in <module>
    from ESMF.interface.loadESMF import _ESMF
  File "/Users/zhuangjw/Research/Computing/miniconda/envs/esmpy/lib/python3.6/site-packages/ESMF/interface/loadESMF.py", line 131, in <module>
    raise ImportError('The ESMF shared library did not load properly.')
ImportError: The ESMF shared library did not load properly.

Conda info:

$conda info

     active environment : esmpy
    active env location : /Users/zhuangjw/Research/Computing/miniconda/envs/esmpy
            shell level : 1
       user config file : /Users/zhuangjw/.condarc
 populated config files :
          conda version : 4.7.12
    conda-build version : not installed
         python version : 3.7.4.final.0
       virtual packages :
       base environment : /Users/zhuangjw/Research/Computing/miniconda  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/zhuangjw/Research/Computing/miniconda/pkgs
                          /Users/zhuangjw/.conda/pkgs
       envs directories : /Users/zhuangjw/Research/Computing/miniconda/envs
                          /Users/zhuangjw/.conda/envs
               platform : osx-64
             user-agent : conda/4.7.12 requests/2.22.0 CPython/3.7.4 Darwin/16.7.0 OSX/10.12.6
                UID:GID : 501:20
             netrc file : None
           offline mode : False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant