Error when compiling PyMethodBase.h ('numpy/numpyconfig.h' file not found)

Dear TMVA experts,

I’m not able to compile any code when including TMVA/PyMethodBase.h in ROOT 6.12/06.
The error is:

/usr/local/include/TMVA/PyMethodBase.h:47:10: fatal error: 'numpy/numpyconfig.h' file not found
#include "numpy/numpyconfig.h"
         ^~~~~~~~~~~~~~~~~~~~~
Error in <ACLiC>: Dictionary generation failed!

I have no problem loading PyMethodBase.h in a simple (not compiled) macro or in an interactive root session. In other words this[1] works, this[2] not.
[1] root macro.C
[2] root macro.C++

I already read this topic:

But I had no problem in the installation.

I encounter this error on multiple systems.

Thank you for any assistance,
Alberto

Hi!

Can you provide a minimal macro.C, which reproduces the error?

Cheers
Stefan

Hi Stephan,
here the most minimal macro I could think of:

test.C (446 Bytes)

No problems with:
root -l test.C

Problems with:
root -l test.C++

Cheers
Alberto

Hi Alberto,

I’ve just tested it and it seems to work for me:

$ root -l -q test.C 
Processing test.C...
Hello World

$ root -l -q test.C++
Processing test.C++...
Info in <TUnixSystem::ACLiC>: creating shared library /some/path/here/./test_C.so
Hello World

Can you provide any further hints?

Cheers
Stefan

P.S.: My ROOT version

$ root-config --version
6.12/06

Hi Stefan,
it seems that one needs to install numpy with apt-get (or equivalent) and not with pip.
After installing numpy with
sudo apt install python-numpy
the error has disappeared.

I assumed it was a ROOT error since I got it both on my personal laptop and on the remote server when I run my job with (CMSSW).

Since it’s not a ROOT error I think this thread can be closed.

Cheers,
Alberto