RuntimeError: module compiled against API version 0xf but this version of numpy is 0xd

If you ever get this error when using numpy e.g. with Azure ML:

RuntimeError: module compiled against API version 0xf but this version of numpy is 0xd


You probably have mismatched versions of Numpy.
Check the version and API version of your Numpy like this:

import numpy.core.setup_common as setup_common
print(numpy.version.short_version)
print(setup_common.C_API_VERSION)

You can check the mapping from Numpy version to C_API_VERSION here:

https://github.com/numpy/numpy/blob/main/numpy/core/setup_common.py