Installing ECMWF’s GRIB-API for Python on Mac OS

I just upgraded my MacPorts to Mac OS Sierra and expected some problems. First I followed the instructions on migrating. Then I uninstalled all ports and started installing the ones I needed as I went along. The ECMWF’s GRIB-API package is one of them.

When installing through MacPorts, and if you need Python bindings, you must run:

sudo port install grib_api +python27

Otherwise, you won’t be able to do this:

from gribapi import *

But I still had a problem, as I got the following error message:

ImportError: No module named _gribapi_swig

Aha, I though, because I remembered that I had to hack this. What it needs is a .so file, a shared object. Ok, so I went into the directory that holds the Python bindings files. In my case that was:


Now I just needed to create a symbolic link:

sudo ln -s _gribapi_swig.dylib

And everything was good to go.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s