RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb numpy numpy

RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb


Seems like this is due to pandas version higher than 0.21.0 and numpyversion 1.13.3 that is pulled by TensorFlow not playing well togather.Here is how I fixed it in my end:

# ipythonPython 2.7.6 (default, Nov 23 2017, 15:49:48)Type "copyright", "credits" or "license" for more information.IPython 4.2.0 -- An enhanced Interactive Python.?         -> Introduction and overview of IPython's features.%quickref -> Quick reference.help      -> Python's own help system.object?   -> Details about 'object', use 'object??' for extra details.In [1]: import tensorflow as tf---------------------------------------------------------------------------RuntimeError                              Traceback (most recent call last)RuntimeError: module compiled against API version 0xc but this version of numpy is 0xbIn [2]: !pip install pandas==0.21.0Collecting pandas==0.21.0/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS requesthas been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the serverto present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.  SNIMissingWarning/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.  InsecurePlatformWarning  Downloading pandas-0.21.0-cp27-cp27mu-manylinux1_x86_64.whl (24.3MB)    100% |################################| 24.3MB 52kB/sRequirement already satisfied: pytz>=2011k in /usr/local/lib/python2.7/dist-packages (from pandas==0.21.0)Requirement already satisfied: numpy>=1.9.0 in /usr/local/lib/python2.7/dist-packages (from pandas==0.21.0)Requirement already satisfied: python-dateutil in /usr/local/lib/python2.7/dist-packages (from pandas==0.21.0)Requirement already satisfied: six>=1.5 in /usr/local/lib/python2.7/dist-packages (from python-dateutil->pandas==0.21.0)Installing collected packages: pandas  Found existing installation: pandas 0.21.1    Uninstalling pandas-0.21.1:      Successfully uninstalled pandas-0.21.1Successfully installed pandas-0.21.0In [3]: del tfIn [4]: import tensorflow as tf


Most likely due to version of numpy too low; this one solved my problem:

pip3 install "numpy == 1.15.0" --user 

conda install can't solve because currently it only have numpy version 1.13.1, but is may due to my mirror site choosen is not the latest


Base on currently installed tensorflow or sklearn packages, there might be some incompatibility. You should try different numpy version. BTW, in my case, downgrading from 1.18 to 1.15 fixed the problem.

pip install "numpy == 1.15.0"