ravens icon indicating copy to clipboard operation
ravens copied to clipboard

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

Open DanielTakeshi opened this issue 3 years ago • 3 comments

I followed the three installation steps for my Ubuntu 18.04 machine to create a conda environment named ravens. The installation seems to have proceeded correctly. However, running the example shows this:

(ravens) seita@starship:~/ravens (master) $ python ravens/demos.py --assets_root=./ravens/environments/assets/ --disp=True --task=block-insertion --mode=train --n=10
2021-07-11 20:47:57.446709: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
pybullet build time: May 11 2021 10:00:39
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
Traceback (most recent call last):
  File "ravens/demos.py", line 25, in <module>
    from ravens import tasks
  File "/home/seita/ravens/ravens/__init__.py", line 18, in <module>
    from ravens import agents
  File "/home/seita/ravens/ravens/agents/__init__.py", line 18, in <module>
    from ravens.agents.conv_mlp import PickPlaceConvMlpAgent
  File "/home/seita/ravens/ravens/agents/conv_mlp.py", line 22, in <module>
    from ravens.models import mdn_utils
  File "/home/seita/ravens/ravens/models/__init__.py", line 18, in <module>
    from ravens.models.attention import Attention
  File "/home/seita/ravens/ravens/models/attention.py", line 21, in <module>
    from ravens.utils import utils
  File "/home/seita/ravens/ravens/utils/utils.py", line 28, in <module>
    import pybullet as p
ImportError: numpy.core.multiarray failed to import

This error is reported elsewhere, for example:

  • https://github.com/freqtrade/freqtrade/issues/4281
  • https://github.com/uber/causalml/issues/338 and https://github.com/uber/causalml/pull/343
  • Older StackOverflow questions such as this and this.

Most fixes suggest upgrading the numpy version. Here is the pastebin of the result of conda list showing that I'm using numpy 1.18.5. However, upgrading numpy does not succeed because TensorFlow 2.3.0 has a strict numpy dependency:

(ravens) seita@starship:~/ravens (master) $ pip install numpy --upgrade
Requirement already satisfied: numpy in /home/seita/miniconda3/envs/ravens/lib/python3.7/site-packages (1.18.5)
Collecting numpy
  Downloading numpy-1.21.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (15.7 MB)
     |████████████████████████████████| 15.7 MB 5.8 MB/s 
Installing collected packages: numpy
  Attempting uninstall: numpy
    Found existing installation: numpy 1.18.5
    Uninstalling numpy-1.18.5:
      Successfully uninstalled numpy-1.18.5
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow 2.3.0 requires numpy<1.19.0,>=1.16.0, but you have numpy 1.21.0 which is incompatible.
Successfully installed numpy-1.21.0

The strange part is, I can actually run the data collection and training scripts, after upgrading numpy. However, because TensorFlow 2.3.0 is supposed to be incompatible (e.g., see here) it's not clear to me that this is an ideal situation. There may be some silent errors or unexpected code usage with the more recent numpy versions.

Is anyone able to reproduce this from a clean installation?

DanielTakeshi avatar Jul 12 '21 01:07 DanielTakeshi

Hello! May I ask you a question? I learned that you proposed Deformable-Ravens based on Ravens, so can you test the model on the source code of Ravens? I have some problems in this link, could you help me solve them? https://github.com/google-research/ravens/issues/25

TriBall3 avatar Apr 01 '22 06:04 TriBall3

Same error. How do you fix it in the end?

zwbx avatar Jan 09 '24 02:01 zwbx

python train.py pybullet build time: Apr 16 2024 14:14:25 RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xd . Check the section C-API incompatibility at the Troubleshooting ImportError section at https://numpy.org/devdocs/user/troubleshooting-importerror.html#c-api-incompatibility for indications on how to solve this problem . Traceback (most recent call last): File "train.py", line 7, in import utils File "/home/tchen/Desktop/zab2024/vla_grasp_zju/Vision-Language-Grasping/utils.py", line 3, in import pybullet as p ImportError: numpy.core.multiarray failed to import

in: https://github.com/zhaianbang/Vision-Language-Grasping, in this project, i meet this problem too.

zhaianbang avatar Apr 16 '24 09:04 zhaianbang