Skip to content

Loading eccodes on MacOS with M1 chip fails with OSError #57

@leroygr

Description

@leroygr

Hi,

I'm trying to install eccodes-python on Mac with M1 chip with MacOs Big Sur. I'm using Python 3.9.5.

I have first build and installed successfully eccodes-c library in /usr/local. Then when install eccodes-python with pip:

$ pip install eccodes

Then I try to load eccodes, I get the following error:

$ python -m eccodes selfcheck
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 188, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 147, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "/Users/gle/dev/3e/dataservices/pipelines/gfs-datasync/eccodes-python-1.3.4/eccodes/__init__.py", line 13, in <module>
    from .eccodes import *  # noqa
  File "/Users/gle/dev/3e/dataservices/pipelines/gfs-datasync/eccodes-python-1.3.4/eccodes/eccodes.py", line 12, in <module>
    from gribapi import (
  File "/Users/gle/dev/3e/dataservices/pipelines/gfs-datasync/eccodes-python-1.3.4/gribapi/__init__.py", line 13, in <module>
    from .gribapi import *  # noqa
  File "/Users/gle/dev/3e/dataservices/pipelines/gfs-datasync/eccodes-python-1.3.4/gribapi/gribapi.py", line 34, in <module>
    from . import errors
  File "/Users/gle/dev/3e/dataservices/pipelines/gfs-datasync/eccodes-python-1.3.4/gribapi/errors.py", line 16, in <module>
    from .bindings import ENC, ffi, lib
  File "/Users/gle/dev/3e/dataservices/pipelines/gfs-datasync/eccodes-python-1.3.4/gribapi/bindings.py", line 45, in <module>
    lib = ffi.dlopen(library_path)
  File "/Users/gle/Envs/gfs-datasync/lib/python3.9/site-packages/cffi/api.py", line 150, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
  File "/Users/gle/Envs/gfs-datasync/lib/python3.9/site-packages/cffi/api.py", line 832, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
  File "/Users/gle/Envs/gfs-datasync/lib/python3.9/site-packages/cffi/api.py", line 828, in _load_backend_lib
    return backend.load_library(path, flags)
OSError: cannot load library '/usr/local/lib/libeccodes.dylib': dlopen(/usr/local/lib/libeccodes.dylib, 2): no suitable image found.  Did find:
        /usr/local/lib/libeccodes.dylib: mach-o, but wrong architecture
        /usr/local/lib/libeccodes.dylib: mach-o, but wrong architecture

I tried several things, also installing eccodes-python from source but it didn't work.

Could anyone help me with this?

Thanks,
Greg

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions