# Segmentation Fault (core dumped) python3

**URL:** <https://root-forum.cern.ch/t/segmentation-fault-core-dumped-python3/34325>\
**Category:** Newbie\
**Created:** [May 30, 2019, 4:41am UTC](https://root-forum.cern.ch/t/segmentation-fault-core-dumped-python3/34325 "2019-05-30T04:41:12Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![M.Sawa51](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/m.sawa51/32/32689_2.png) [@M.Sawa51](https://root-forum.cern.ch/u/M.Sawa51)\
**Post date:** [May 30, 2019, 4:41am UTC](https://root-forum.cern.ch/t/segmentation-fault-core-dumped-python3/34325/1 "2019-05-30T04:41:12Z")

</div>

* * *

\_ROOT Version:root-6.16.00  
\_Platform: Windows Subsystem for Linux(Ubuntu 18.04 LTE)  
_Compiler:_ cmake (3.10.2)

* * *

Hello everyone,  
I’m a beginner of ROOT and all computing analysis.  
I’ve already compiled ROOT with cmake and I would like to use pyROOT from python3.  
So I Then, I got an error message below.

$ pyhton3  
Python 3.6.7 (default, Oct22 2018, 11:32:17)  
[GCC 8.2.0] on linux

> > > import ROOT  
> > > [1] 10220 segmentation fault (core dumped) python3  
> > > $

I already searched the web and Stack Overflow but I couldn’t find any answer.  
I have no idea to solve this error.  
What does " segmentation fault " mean?

Any help will be appreciated.

Makoto

---

<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:** [May 31, 2019, 8:24am UTC](https://root-forum.cern.ch/t/segmentation-fault-core-dumped-python3/34325/2 "2019-05-31T08:24:15Z")

</div>

Dear Makoto,

Please make sure you follow the instructions to build ROOT at this link:  
[https://root.cern.ch/building-root](https://root.cern.ch/building-root)

In particular, it is important to make sure you built ROOT with the Python3 installation you want to use. The following properties:

| Python | PYTHON\_EXECUTABLE | PATH | Python interpreter executable |
| --- | --- | --- | --- |
| | PYTHON\_INCLUDE\_DIR | PATH | Directory where to find Python.h |
| | PYTHON\_LIBRARY | PATH | Full path to Python library |

should point to the right Python installation. You can check if that is the case by inspecting `CMakeCache.txt` in your build directory and looking for the value of those properties.

---

<div class="post-metadata">

**Author:** ![M.Sawa51](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/m.sawa51/32/32689_2.png) [@M.Sawa51](https://root-forum.cern.ch/u/M.Sawa51)\
**Post date:** [May 31, 2019, 12:03pm UTC](https://root-forum.cern.ch/t/segmentation-fault-core-dumped-python3/34325/3 "2019-05-31T12:03:58Z")

</div>

Dear etejedor,  
thank you for your quick reply and then I checked CMakeCache.txt.  
Here’s my CMakeCache.txt ( PYTHON\_INCLUDE\_DIR & PYTHON\_LIBRARY).

PYTHON3:UNINITIALIZED=ON

PYTHON3-CACHED:STRING=ON

//Path to a program.  
PYTHON\_EXECUTABLE:FILEPATH=/usr/bin/python3

PYTHON\_EXECUTABLE-CACHED:STRING=/usr/bin/python3

//Path to a file.  
PYTHON\_INCLUDE\_DIR:PATH=/usr/include/python3.6m

//Path to a library.  
PYTHON\_LIBRARY:FILEPATH=/usr/lib/x86\_64-linux-gnu/libpython3.6m.so

I cannot figure out what is wrong.  
The PYTHON\_INCLUDE\_DIR points /usr/include/python3.6m and it has Python.h.

Regards,  
Makoto

---

<div class="post-metadata">

**Author:** ![mmccracken](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@mmccracken](https://root-forum.cern.ch/u/mmccracken)\
**Post date:** [June 3, 2019, 7:31pm UTC](https://root-forum.cern.ch/t/segmentation-fault-core-dumped-python3/34325/4 "2019-06-03T19:31:42Z")

</div>

Hi, all,  
Just to add another data point here, I am having what seems to be the same issue. I’ve checked my CMakeCache.txt, and the environment variables are pointing to the correct places (as far as I can tell).  
I’m on Mac OSX, running Anaconda python3.7. I’ve tried a fresh build of ROOT (6.16.00). cmake seems to get all of the environment variables correct on its own.

The error is manifesting as

```auto
mmcc @ ~> python
Python 3.7.3 (default, Mar 27 2019, 16:54:48)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ROOT import TVector3

 ***Break*** segmentation violation
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[<unknown binary>] (no debug info)
[/anaconda3/lib/libpython3.7m.dylib] PyUnicode_InternFromString (no debug info)
[/usr/local/root_build//lib//libPyROOT.so] PyROOT::CreatePyStrings() /usr/local/root-6.16.00/bindings/pyroot/src/PyStrings.cxx:64
[/usr/local/root_build//lib//libPyROOT.so] PyInit_libPyROOT /usr/local/root-6.16.00/bindings/pyroot/src/RootModule.cxx:848
[/anaconda3/bin//python] _PyImport_LoadDynamicModuleWithSpec (no debug info)
[/anaconda3/bin//python] _imp_create_dynamic (no debug info)
[/anaconda3/bin//python] _PyMethodDef_RawFastCallDict (no debug info)
[/anaconda3/bin//python] PyCFunction_Call (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] _PyEval_EvalCodeWithName (no debug info)
[/anaconda3/bin//python] _PyFunction_FastCallKeywords (no debug info)
[/anaconda3/bin//python] call_function (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] function_code_fastcall (no debug info)
[/anaconda3/bin//python] call_function (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] function_code_fastcall (no debug info)
[/anaconda3/bin//python] call_function (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] function_code_fastcall (no debug info)
[/anaconda3/bin//python] call_function (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] function_code_fastcall (no debug info)
[/anaconda3/bin//python] call_function (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] function_code_fastcall (no debug info)
[/anaconda3/bin//python] object_vacall (no debug info)
[/anaconda3/bin//python] _PyObject_CallMethodIdObjArgs (no debug info)
[/anaconda3/bin//python] PyImport_ImportModuleLevelObject (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] _PyEval_EvalCodeWithName (no debug info)
[/anaconda3/bin//python] builtin_exec (no debug info)
[/anaconda3/bin//python] _PyMethodDef_RawFastCallDict (no debug info)
[/anaconda3/bin//python] PyCFunction_Call (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] _PyEval_EvalCodeWithName (no debug info)
[/anaconda3/bin//python] _PyFunction_FastCallKeywords (no debug info)
[/anaconda3/bin//python] call_function (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] function_code_fastcall (no debug info)
[/anaconda3/bin//python] call_function (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] function_code_fastcall (no debug info)
[/anaconda3/bin//python] call_function (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] function_code_fastcall (no debug info)
[/anaconda3/bin//python] call_function (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] function_code_fastcall (no debug info)
[/anaconda3/bin//python] object_vacall (no debug info)
[/anaconda3/bin//python] _PyObject_CallMethodIdObjArgs (no debug info)
[/anaconda3/bin//python] PyImport_ImportModuleLevelObject (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] _PyEval_EvalCodeWithName (no debug info)
[/anaconda3/bin//python] builtin_exec (no debug info)
[/anaconda3/bin//python] _PyMethodDef_RawFastCallDict (no debug info)
[/anaconda3/bin//python] PyCFunction_Call (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] _PyEval_EvalCodeWithName (no debug info)
[/anaconda3/bin//python] _PyFunction_FastCallKeywords (no debug info)
[/anaconda3/bin//python] call_function (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] function_code_fastcall (no debug info)
[/anaconda3/bin//python] call_function (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] function_code_fastcall (no debug info)
[/anaconda3/bin//python] call_function (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] function_code_fastcall (no debug info)
[/anaconda3/bin//python] call_function (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] function_code_fastcall (no debug info)
[/anaconda3/bin//python] object_vacall (no debug info)
[/anaconda3/bin//python] _PyObject_CallMethodIdObjArgs (no debug info)
[/anaconda3/bin//python] PyImport_ImportModuleLevelObject (no debug info)
[/anaconda3/bin//python] _PyEval_EvalFrameDefault (no debug info)
[/anaconda3/bin//python] _PyEval_EvalCodeWithName (no debug info)
[/anaconda3/bin//python] PyRun_InteractiveOneObjectEx (no debug info)
[/anaconda3/bin//python] PyRun_InteractiveLoopFlags (no debug info)
[/anaconda3/bin//python] PyRun_AnyFileExFlags (no debug info)
[/anaconda3/bin//python] pymain_main (no debug info)
[/anaconda3/bin//python] main (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)
[<unknown binary>] (no debug info)
mmcc @ ~>

```

Here is the relevant content of CMakeCache.txt, if it’s useful:

```auto
//Path to a program.
PYTHON_EXECUTABLE:FILEPATH=/anaconda3/bin/python

//Path to a file.
PYTHON_INCLUDE_DIR:PATH=/anaconda3/include/python3.7m

//Path to a library.
PYTHON_LIBRARY:FILEPATH=/anaconda3/lib/libpython3.7m.dylib

//Path to a library.
PYTHON_LIBRARY_DEBUG:FILEPATH=PYTHON_LIBRARY_DEBUG-NOTFOUND

```

/usr/local/root\_build/lib is in my PYTHONPATH, as well.

Thanks for any help.  
-mike

---

<div class="post-metadata">

**Author:** ![mmccracken](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@mmccracken](https://root-forum.cern.ch/u/mmccracken)\
**Post date:** [June 4, 2019, 7:20pm UTC](https://root-forum.cern.ch/t/segmentation-fault-core-dumped-python3/34325/5 "2019-06-04T19:20:25Z")

</div>

More info: Last night I installed a new Xcode (10.2.1), reinstalled Anaconda python (3.7), and rebuilt ROOT (6.16.00), and am having the same segmentation fault.

I installed anaconda3 in a different location, and the cmake configuration picked it up correctly.

-m

---

<div class="post-metadata">

**Author:** ![M.Sawa51](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/m.sawa51/32/32689_2.png) [@M.Sawa51](https://root-forum.cern.ch/u/M.Sawa51)\
**Post date:** [June 5, 2019, 10:07am UTC](https://root-forum.cern.ch/t/segmentation-fault-core-dumped-python3/34325/6 "2019-06-05T10:07:23Z")

</div>

Hi, mmccracken  
How did you reinstalled Anaconda python?

From Source code or brew install command?

Regards,  
Makoto

---

<div class="post-metadata">

**Author:** ![mmccracken](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@mmccracken](https://root-forum.cern.ch/u/mmccracken)\
**Post date:** [June 5, 2019, 11:30am UTC](https://root-forum.cern.ch/t/segmentation-fault-core-dumped-python3/34325/7 "2019-06-05T11:30:09Z")

</div>

Hi, Makoto,

I installed with the .pkg graphical installer.

Last night I tried to roll back to ROOT 6.14.06, but the same segmentation fault occurs.

-mike

---

<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:** [June 5, 2019, 2:57pm UTC](https://root-forum.cern.ch/t/segmentation-fault-core-dumped-python3/34325/8 "2019-06-05T14:57:06Z")

</div>

The CMakeCache.txt seems correct for what respects Python, did you build this in Ubuntu?

@amadio any other comment?

---

<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:** [June 5, 2019, 3:00pm UTC](https://root-forum.cern.ch/t/segmentation-fault-core-dumped-python3/34325/9 "2019-06-05T15:00:13Z")

</div>

Building ROOT and using Anaconda is a tricky combination. The compiler that you use to build ROOT should be the same compiler that Anaconda comes with.

In case you are interested, there is now a distribution of ROOT with Conda, which you can install with:  
`conda create --name my-root-env --channel conda-forge python=3 root`

---

<div class="post-metadata">

**Author:** ![amadio](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amadio/32/12562_2.png) [@amadio](https://root-forum.cern.ch/u/amadio)\
**Post date:** [June 5, 2019, 3:05pm UTC](https://root-forum.cern.ch/t/segmentation-fault-core-dumped-python3/34325/10 "2019-06-05T15:05:43Z")

</div>

Could you please paste here the output of `otool -L path/to/libPyROOT.so`? and the same for the python you use (i.e. `otool -L $(which python)`). That will help in debugging the problem.

---

<div class="post-metadata">

**Author:** ![mmccracken](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@mmccracken](https://root-forum.cern.ch/u/mmccracken)\
**Post date:** [June 5, 2019, 7:52pm UTC](https://root-forum.cern.ch/t/segmentation-fault-core-dumped-python3/34325/11 "2019-06-05T19:52:02Z")

</div>

> [@amadio](#):
>
> otool -L path/to/libPyROOT.so

Hi, Amadio. See below:

```auto
mmcc @ ~>
mmcc @ ~> otool -L /usr/local/root_build/lib//libPyROOT.so
/usr/local/root_build/lib//libPyROOT.so:
	@rpath/libPyROOT.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libpython3.6m.dylib (compatibility version 3.6.0, current version 3.6.0)
	@rpath/libTree.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libRIO.so (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libCore.so (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)
mmcc @ ~>
mmcc @ ~> otool -L /anaconda3/bin/python
/anaconda3/bin/python:
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
mmcc @ ~>

```

Looks like both refer to the same libSystem.B.dylib, but current versions are different. Strange since I installed both in the last few hours… or maybe (probably) I’m misunderstanding otool’s output.

Thanks for your help!

-m

---

<div class="post-metadata">

**Author:** ![mmccracken](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@mmccracken](https://root-forum.cern.ch/u/mmccracken)\
**Post date:** [June 5, 2019, 10:36pm UTC](https://root-forum.cern.ch/t/segmentation-fault-core-dumped-python3/34325/12 "2019-06-05T22:36:08Z")

</div>

Yes, the odd thing is that I had it working as recently as March (I think). I updated my Anaconda when I upgraded to TensorFlow 2.0, and that seems to have broken pyroot.

Since yesterday, I’ve tried several combinations of ROOT 6.16 and 6.14 with python3.6 and python3.7, with the same segmentation fault, so all signs are pointing to me having done something wrong during the install process. If I can’t locate the problem, I’ll give the Conda ROOT a try.

Thanks!

---

<div class="post-metadata">

**Author:** ![mmccracken](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@mmccracken](https://root-forum.cern.ch/u/mmccracken)\
**Post date:** [June 6, 2019, 2:10am UTC](https://root-forum.cern.ch/t/segmentation-fault-core-dumped-python3/34325/13 "2019-06-06T02:10:16Z")

</div>

Etejedor, after a few more attempts to fix the ROOT install, I broke down and installed via conda. Thanks for the tip. Everything is working well.

-mike

---

<div class="post-metadata">

**Author:** ![M.Sawa51](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/m.sawa51/32/32689_2.png) [@M.Sawa51](https://root-forum.cern.ch/u/M.Sawa51)\
**Post date:** [June 6, 2019, 2:43am UTC](https://root-forum.cern.ch/t/segmentation-fault-core-dumped-python3/34325/14 "2019-06-06T02:43:31Z")

</div>

Yes, I build ROOT in Ubuntu 18.04 (WSL).

I tried ldd cmmand instead of otool and terminal showed below.

"  
ldd $(which python)  
linux-vdso.so.1 (0x00007fffe4ed3000)  
libc.so.6 =\> /lib/x86\_64-linux-gnu/libc.so.6 (0x00007fcd02eb0000)  
libpthread.so.0 =\> /lib/x86\_64-linux-gnu/libpthread.so.0 (0x00007fcd02c90000)  
libdl.so.2 =\> /lib/x86\_64-linux-gnu/libdl.so.2 (0x00007fcd02a80000)  
libutil.so.1 =\> /lib/x86\_64-linux-gnu/libutil.so.1 (0x00007fcd02870000)  
libz.so.1 =\> /lib/x86\_64-linux-gnu/libz.so.1 (0x00007fcd02650000)  
libm.so.6 =\> /lib/x86\_64-linux-gnu/libm.so.6 (0x00007fcd022b0000)  
/lib64/ld-linux-x86-64.so.2 (0x00007fcd03a00000)  
"

---

<div class="post-metadata">

**Author:** ![M.Sawa51](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/m.sawa51/32/32689_2.png) [@M.Sawa51](https://root-forum.cern.ch/u/M.Sawa51)\
**Post date:** [June 6, 2019, 3:01am UTC](https://root-forum.cern.ch/t/segmentation-fault-core-dumped-python3/34325/16 "2019-06-06T03:01:17Z")

</div>

Excuse me, I have typed the wrong command.

> ldd $(which python3) /usr/local/ROOT/root-6.16.00/cmake-build/lib  
> /usr/bin/python3:  
> linux-vdso.so.1 (0x00007ffff2e8f000)  
> libc.so.6 =\> /lib/x86\_64-linux-gnu/libc.so.6 (0x00007ff32bfb0000)  
> libpthread.so.0 =\> /lib/x86\_64-linux-gnu/libpthread.so.0 (0x00007ff32bd90000)  
> libdl.so.2 =\> /lib/x86\_64-linux-gnu/libdl.so.2 (0x00007ff32bb80000)  
> libutil.so.1 =\> /lib/x86\_64-linux-gnu/libutil.so.1 (0x00007ff32b970000)  
> libexpat.so.1 =\> /lib/x86\_64-linux-gnu/libexpat.so.1 (0x00007ff32b730000)  
> libz.so.1 =\> /lib/x86\_64-linux-gnu/libz.so.1 (0x00007ff32b510000)  
> libm.so.6 =\> /lib/x86\_64-linux-gnu/libm.so.6 (0x00007ff32b160000)  
> /lib64/ld-linux-x86-64.so.2 (0x00007ff32c400000)  
> /usr/local/ROOT/root-6.16.00/cmake-build/lib:  
> ldd: /usr/local/ROOT/root-6.16.00/cmake-build/lib: not regular file

My terminal showed this and I assume I need to rebuild ROOT.  
However, what should I do?  
Do I have to clear build directory and then rebuild it?
