# Wrapping ROOT classes for Python

**URL:** <https://root-forum.cern.ch/t/wrapping-root-classes-for-python/21845>\
**Category:** ROOT\
**Created:** [September 9, 2016, 2:50pm UTC](https://root-forum.cern.ch/t/wrapping-root-classes-for-python/21845 "2016-09-09T14:50:12Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![quantatanu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/quantatanu/32/20730_2.png) [@quantatanu](https://root-forum.cern.ch/u/quantatanu)\
**Post date:** [May 7, 2020, 4:24pm UTC](https://root-forum.cern.ch/t/wrapping-root-classes-for-python/21845/4 "2020-05-07T16:24:22Z")

</div>

I was asking this in a [wrong thread](https://root-forum.cern.ch/t/how-does-one-turn-the-gdml-feature-on-during-root-installation/39253/20) (thread concerning **GDML** ), found this thread that seems appropriate so posting my sub-question here:

I am using pre-compiled root binaries (stored in `/dir/to/ROOT/version/`), how do I import `ROOT` to `python` so that I can install and use software like [GeGeDe](https://github.com/brettviren/gegede/blob/master/doc/install.org), this `installation` guide suggests doing:

```auto
$ sudo apt-et install libroot-bindings-python5.34
$ export PYTHONPATH=/usr/lib/x86_64-linux-gnu/root5.34
$ python -c 'import ROOT' # <-- just a test...

```

With pre-compiled binaries, what I did is, exported:

```auto
export PYTHONPATH="dir/to/ROOT/version/lib/"

```

of course `thisroot.sh` has been sourced before this.

Then

```auto
python -c 'import ROOT'
Segmentation fault (core dumped)

```

It segfaults!  
I am attaching the verbose of 2 python versions.

2.7: [python2.7\_import\_ROOT\_verbose.txt](https://root-forum.cern.ch/uploads/short-url/g1yuP9Rb9kyuIaj2eF05ryVMvNy.txt) (6.6 KB)  
3.6: [python3.6m\_import\_ROOT\_verbose.txt](https://root-forum.cern.ch/uploads/short-url/sj3qNJRMnBBBRKxIwfosV7RbIh4.txt) (42.1 KB)

Originally my question was a part of [this thread](https://root-forum.cern.ch/t/how-does-one-turn-the-gdml-feature-on-during-root-installation/39253/20).

### SYSTEM DETAILS

\_ROOT Versions: ROOT 6.18/04, 6.20/04 [pre-compiled bianries]  
\_Platform: Ubuntu 18.04.4 LTS  
\_Compiler: g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

---

_[View the full topic](https://root-forum.cern.ch/t/wrapping-root-classes-for-python/21845)._
