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

**URL:** <https://root-forum.cern.ch/t/error-when-compiling-pymethodbase-h-numpy-numpyconfig-h-file-not-found/29177>\
**Category:** TMVA\
**Created:** [May 29, 2018, 12:01pm UTC](https://root-forum.cern.ch/t/error-when-compiling-pymethodbase-h-numpy-numpyconfig-h-file-not-found/29177 "2018-05-29T12:01:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![a.bragagnolo](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@a.bragagnolo](https://root-forum.cern.ch/u/a.bragagnolo)\
**Post date:** [May 29, 2018, 12:01pm UTC](https://root-forum.cern.ch/t/error-when-compiling-pymethodbase-h-numpy-numpyconfig-h-file-not-found/29177/1 "2018-05-29T12:01:24Z")

</div>

Dear TMVA experts,

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

```auto
/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:

> [@TMVA fatal error: 'numpy/numpyconfig.h' file not found](https://root-forum.cern.ch/t/tmva-fatal-error-numpy-numpyconfig-h-file-not-found/22430):
>
> I tried to install root Version 6.08.00 on Linux openSuse Leap 42.1. During cmake of TMVA following error occurs: [ul][64%] Built target rootcling Scanning dependencies of target G\_\_PyMVA [64%] Generating G\_\_PyMVA.cxx, …/…/lib/libPyMVA\_rdict.pcm, …/…/lib/libPyMVA.rootmap Scanning dependencies of target G\_\_MultiProc [64%] Generating G\_\_MultiProc.cxx, …/…/lib/libMultiProc\_rdict.pcm, …/…/lib/libMultiProc.rootmap In file included from input\_line\_12:6: /home/bernhardi/rootbindir800/includ…

But I had no problem in the installation.

I encounter this error on multiple systems.

Thank you for any assistance,  
Alberto

---

<div class="post-metadata">

**Author:** ![swunsch](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/50afbb/32.png) [@swunsch](https://root-forum.cern.ch/u/swunsch)\
**Post date:** [May 30, 2018, 9:04am UTC](https://root-forum.cern.ch/t/error-when-compiling-pymethodbase-h-numpy-numpyconfig-h-file-not-found/29177/2 "2018-05-30T09:04:10Z")

</div>

Hi!

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

Cheers  
Stefan

---

<div class="post-metadata">

**Author:** ![a.bragagnolo](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@a.bragagnolo](https://root-forum.cern.ch/u/a.bragagnolo)\
**Post date:** [May 30, 2018, 9:23am UTC](https://root-forum.cern.ch/t/error-when-compiling-pymethodbase-h-numpy-numpyconfig-h-file-not-found/29177/3 "2018-05-30T09:23:36Z")

</div>

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

[test.C](https://root-forum.cern.ch/uploads/default/original/3X/d/1/d1e36b47a8c2a93faa68a94fdb27fd0ec8281da5.C) (446 Bytes)

No problems with:  
root -l test.C

Problems with:  
root -l test.C++

Cheers  
Alberto

---

<div class="post-metadata">

**Author:** ![swunsch](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/50afbb/32.png) [@swunsch](https://root-forum.cern.ch/u/swunsch)\
**Post date:** [May 31, 2018, 1:18pm UTC](https://root-forum.cern.ch/t/error-when-compiling-pymethodbase-h-numpy-numpyconfig-h-file-not-found/29177/4 "2018-05-31T13:18:07Z")

</div>

Hi Alberto,

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

```bash
$ 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

```bash
$ root-config --version
6.12/06

```

---

<div class="post-metadata">

**Author:** ![a.bragagnolo](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@a.bragagnolo](https://root-forum.cern.ch/u/a.bragagnolo)\
**Post date:** [June 1, 2018, 9:39am UTC](https://root-forum.cern.ch/t/error-when-compiling-pymethodbase-h-numpy-numpyconfig-h-file-not-found/29177/5 "2018-06-01T09:39:45Z")

</div>

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
