1

hello i am trying to run a git repo in google colab, i installed all requirements as per the git instruction

while running the certain file i am getting this error

fatal error: numpy/arrayobject.h: No such file or directory
#include "numpy/arrayobject.h"

i already checked solution for this error but they recommended to change the code in setup.py but i am running the file in google colab so some body help me

the command i ran in google colab was

     !python build.py build_ext --inplace

for which i got the following error could some body help me , i verified that numpy was already installed

    running build_ext
    skipping '_nms_gpu_post.c' Cython extension (up-to-date)
    building '_nms_gpu_post' extension
    creating build/temp.linux-x86_64-3.6
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c _nms_gpu_post.c -o build/temp.linux-x86_64-3.6/_nms_gpu_post.o
    _nms_gpu_post.c:485:10: fatal error: numpy/arrayobject.h: No such file or directory
     #include "numpy/arrayobject.h"
              ^~~~~~~~~~~~~~~~~~~~~
     compilation terminated.
     error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
SriHarsha
  • 41
  • 8
  • Does this answer your question? [Cython: "fatal error: numpy/arrayobject.h: No such file or directory"](https://stackoverflow.com/questions/14657375/cython-fatal-error-numpy-arrayobject-h-no-such-file-or-directory) – Daan Seuntjens Nov 05 '20 at 09:13

1 Answers1

1

I had a similar problem and I solved it by editing build.py:

ext_modules=[
        Extension("my_module", ["my_module.c"],
                  include_dirs=[numpy.get_include()]),
    ]

Here include_dirs=[numpy.get_include()] is the part that's needed to solve it.

Daan Seuntjens
  • 880
  • 1
  • 18
  • 37