# Rootcling with python and numpy

**URL:** <https://root-forum.cern.ch/t/rootcling-with-python-and-numpy/37299>\
**Category:** ROOT\
**Tags:** python, cling\
**Created:** [December 22, 2019, 9:50pm UTC](https://root-forum.cern.ch/t/rootcling-with-python-and-numpy/37299 "2019-12-22T21:50:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcodeltutto](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/df788c/32.png) [@marcodeltutto](https://root-forum.cern.ch/u/marcodeltutto)\
**Post date:** [December 22, 2019, 9:50pm UTC](https://root-forum.cern.ch/t/rootcling-with-python-and-numpy/37299/1 "2019-12-22T21:50:22Z")

</div>

* * *

_ROOT Version:_ v6.18.04 and v6.12.06  
_Platform:_ SLF6  
_Compiler:_ gcc 7.3.0

* * *

Hello, I am building an application using rootcling that also links to python and numpy. I can successfully do this with `ROOT v6.12.06`, but since I switched to `v6.18.04` the following error appears:

* * *

**[…]/lib/python2.7/site-packages/numpy-1.15.4-py2.7-linux-x86\_64.egg/numpy/core/include/numpy/ndarraytypes.h:719:30:** error: **typedef redefinition with different types (‘PyArrayObject\_fields’ (aka ‘tagPyArrayObject\_fields’) vs ‘tagPyArrayObject’)**  
typedef PyArrayObject\_fields PyArrayObject;

**[…]/root/v6\_18\_04b/Linux64bit+2.6-2.12-e17-prof/etc/…/include/TMVA/PyMethodBase.h:50:26: note:** previous definition is here  
typedef tagPyArrayObject PyArrayObject;

* * *

I made a simplified project that reproduces this issue (available [here](https://github.com/marcodeltutto/example_rootcling)). In this project, a class “ExampleClass” is built, which uses numpy array objects included via

```auto
#include "Python.h"
#include "numpy/arrayobject.h"

```

I also added a simple GNU makefile to build this class, which calls `rootcling` and then `g++` as described [here](https://root.cern.ch/interacting-shared-libraries-rootcling). Once built, the library `libMyLib.so` is created, then:

```auto
root -l 
> gROOT->ProcessLine(".L libMyLib.so")
> example::ExampleClass e

```

This works fine with `ROOT v6.12.06`, but it returns the above error with `v6.18.04`. Not sure if I am doing something wrong or if I should submit a ticket for a bug to be fixed. Thank you!

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [January 6, 2020, 3:27pm UTC](https://root-forum.cern.ch/t/rootcling-with-python-and-numpy/37299/3 "2020-01-06T15:27:16Z")

</div>

May be @etejedor can help ?

---

<div class="post-metadata">

**Author:** ![etejedor](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://root-forum.cern.ch/u/etejedor)\
**Post date:** [January 7, 2020, 1:18pm UTC](https://root-forum.cern.ch/t/rootcling-with-python-and-numpy/37299/4 "2020-01-07T13:18:50Z")

</div>

Hi,

This should be fixed when

> <https://github.com/root-project/root/pull/4723>

  
is merged.

Perhaps @moneta can confirm.

Enric
