'Tensorflow error TF error: module compiled against API version 0xe but this version of numpy is 0xd
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd Traceback (most recent call last): File "Tensorflow/scripts/generate_tfrecord.py", line 27, in import tensorflow.compat.v1 as tf File "C:\Users\ateyu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_init_.py", line 37, in from tensorflow.python.tools import module_util as module_util File "C:\Users\ateyu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python_init.py", line 37, in from tensorflow.python.eager import context File "C:\Users\ateyu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\eager\context.py", line 35, in from tensorflow.python.client import pywrap_tf_session File "C:\Users\ateyu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\client\pywrap_tf_session.py", line 19, in from tensorflow.python.client.pywrap_tf_session import * ImportError: SystemError: <built-in method contains of dict object at 0x000002901E7A0630> returned a result with an error set RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd Traceback (most recent call last): File "Tensorflow/scripts/generate_tfrecord.py", line 27, in import tensorflow.compat.v1 as tf File "C:\Users\ateyu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_init.py", line 37, in from tensorflow.python.tools import module_util as module_util File "C:\Users\ateyu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python_init.py", line 37, in from tensorflow.python.eager import context File "C:\Users\ateyu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\eager\context.py", line 35, in from tensorflow.python.client import pywrap_tf_session File "C:\Users\ateyu\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\client\pywrap_tf_session.py", line 19, in from tensorflow.python.client._pywrap_tf_session import * ImportError: SystemError: <built-in method contains of dict object at 0x000001B8DA1705E8> returned a result with an error set
Solution 1:[1]
Kindly check the C-API version and Numpy version from here.
The error message suggests that you have a version of Numpy that provides an older version of the C-API. Based on this, you should upgrade Numpy to 1.20.x or 1.21.x
Please use the following code to upgrade Numpy;
pip install numpy --upgrade --ignore-installed
or you can use the following;
pip install numpy==1.21.6
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Tfer3 |