# Trouble importing pyROOT on OSX 10.9 Mavericks

**URL:** <https://root-forum.cern.ch/t/trouble-importing-pyroot-on-osx-10-9-mavericks/17287>\
**Category:** ROOT\
**Created:** [February 27, 2014, 12:33pm UTC](https://root-forum.cern.ch/t/trouble-importing-pyroot-on-osx-10-9-mavericks/17287 "2014-02-27T12:33:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zimmerst](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/z/eb8c5e/32.png) [@zimmerst](https://root-forum.cern.ch/u/zimmerst)\
**Post date:** [February 27, 2014, 12:33pm UTC](https://root-forum.cern.ch/t/trouble-importing-pyroot-on-osx-10-9-mavericks/17287/1 "2014-02-27T12:33:33Z")

</div>

Hi everyone!

I’ve followed the thread laid out here:  
[root.cern.ch/phpBB3/viewtopic.p … 9ae8a01de1]([pyRoot on OS X Maverick](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/1)  
and ROOT appears to work just fine - I’ve tried out the $ROOTSYS/tutorials and all of them appear to be working.

This is my setup:  
ROOT 5.34/14 (v5-34-14@v5-34-14, Dec 16 2013, 12:23:58 on macosx64)

However, when trying to run pyroot, i.e. import ROOT in a python session, python dies right away:

Python 2.7.6 |Anaconda 1.9.0 (x86\_64)| (default, Jan 10 2014, 11:23:15)  
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin  
Type “help”, “copyright”, “credits” or “license” for more information.

> > > import ROOT  
> > > Fatal Python error: PyThreadState\_Get: no current thread  
> > > Abort trap: 6

Trying to debug with lldb (apple decided to get rid of gdb) yields marginally more insight but not enough to know what’s going on:

lldb python  
Current executable set to ‘python’ (x86\_64).  
(lldb) run  
Process 68145 launched: ‘/Users/zimmer/anaconda/bin/python’ (x86\_64)  
Python 2.7.6 |Anaconda 1.9.0 (x86\_64)| (default, Jan 10 2014, 11:23:15)  
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin  
Type “help”, “copyright”, “credits” or “license” for more information.

> > > import ROOT  
> > > Fatal Python error: PyThreadState\_Get: no current thread  
> > > Process 68145 stopped

- thread #1: tid = 0x8d92c, 0x00007fff92325866 libsystem\_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread, stop reason = signal SIGABRT frame #0: 0x00007fff92325866 libsystem_kernel.dylib`\_\_pthread\_kill + 10  
libsystem\_kernel.dylib`\_\_pthread\_kill + 10:  
 → 0x7fff92325866: jae 0x7fff92325870 ; \_\_pthread\_kill + 20  
0x7fff92325868: movq %rax, %rdi  
0x7fff9232586b: jmpq 0x7fff92322175 ; cerror\_nocancel  
0x7fff92325870: ret  
(lldb)

I’ve tried to debug this without any success so far and would appreciate if anyone would happen to know a fix on how to resolve this. Thanks!

P.s. I get the same results when I try to follow these instructions  
[alexpearce.me/2013/12/root-on-os-x-mavericks/](https://alexpearce.me/2013/12/root-on-os-x-mavericks/)  
and use homebrew to build root.

---

<div class="post-metadata">

**Author:** ![wlav](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/f07891/32.png) [@wlav](https://root-forum.cern.ch/u/wlav)\
**Post date:** [February 27, 2014, 9:39pm UTC](https://root-forum.cern.ch/t/trouble-importing-pyroot-on-osx-10-9-mavericks/17287/2 "2014-02-27T21:39:05Z")

</div>

Hi,

this happens when ROOT is built against one python, then imported in another. Make sure that they’re consistent, by having the custom python you intend to use first up in $PATH (and by pointing --with-python-libdir and --with-python-incdir to your custom python as needed).

(In general, I recommend to stick to the system python on Mac, or use a packager like e.g. MacPorts.)

Cheers,  
Wim

---

<div class="post-metadata">

**Author:** ![roda](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@roda](https://root-forum.cern.ch/u/roda)\
**Post date:** [November 25, 2014, 9:55am UTC](https://root-forum.cern.ch/t/trouble-importing-pyroot-on-osx-10-9-mavericks/17287/3 "2014-11-25T09:55:24Z")

</div>

Hello,  
I had the same problem and I found very useful to fix this problem this post:  
[groups.google.com/a/continuum.i … NxLsRxLcwJ](https://groups.google.com/a/continuum.io/forum/#!msg/anaconda/8kSroSuKpBQ/qENxLsRxLcwJ)  
In particular I fixed the problem using:

[quote]Everything I have read suggests this is due to conflicting python installations. So following some other threads, I do the following

otool -L /Users/walkloud/install/root/lib/libPyROOT.so

/Users/walkloud/install/root/lib/libPyROOT.so:

@rpath/libPyROOT.so (compatibility version 0.0.0, current version 0.0.0)

/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

@rpath/libRIO.so (compatibility version 0.0.0, current version 0.0.0)

@rpath/libTree.so (compatibility version 0.0.0, current version 0.0.0)

@rpath/libCore.so (compatibility version 0.0.0, current version 0.0.0)

@rpath/libCint.so (compatibility version 0.0.0, current version 0.0.0)

libpython2.7.dylib (compatibility version 2.7.0, current version 2.7.0)

/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)

The second to last line is the culprit - this lib should be pointing to the anaconda python lib, but it is actually catching the /System python lib… So then I use install\_name\_tool to fix the path of this lib

install\_name\_tool -change libpython2.7.dylib /Users/walkloud/install/anaconda/lib/libpython2.7.dylib [libPyROOT.so](http://libPyROOT.so)  
and then the above ROOT import works and I can interact as described via the pyroot docs, at least the minimal testing.

[/quote]

---

<div class="post-metadata">

**Author:** ![cranmer](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/e495f1/32.png) [@cranmer](https://root-forum.cern.ch/u/cranmer)\
**Post date:** [March 4, 2016, 1:20am UTC](https://root-forum.cern.ch/t/trouble-importing-pyroot-on-osx-10-9-mavericks/17287/4 "2016-03-04T01:20:10Z")

</div>

I’m having the same problem with pyroot and anaconda. I’ve tried cmake and the old style ./configure; make

Mac OS X El Capitan 10.11.3

`root-v6-06-02$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.3.0
Thread model: posix`

`root-v6-06-02$ python --version
Python 2.7.11 :: Anaconda 2.5.0 (x86_64)`

`root-v6-06-02$ which python
//anaconda/bin/python`

[code]root\_git$ git branch

- v6-06-02[/code]

I make a parallel directory to build and issue this cmake command

```auto
cmake ../root_git/ -Dall=ON -Droofit=ON -Dcxx14=OFF -DPYTHON_EXECUTABLE=/anaconda/bin/python2.7 -DPYTHON_INCLUDE_DIR=/anaconda/include/python2.7 -DPYTHON_LIBRARY=/anaconda/lib/libpython2.7.dylib 
```

build succeeds  
[`100%] Built target hist2workspace`

then:

[code]root-v6-06-02$ source bin/thisroot.sh

root-v6-06-02$ python  
Python 2.7.11 |Anaconda 2.5.0 (x86\_64)| (default, Dec 6 2015, 18:57:58)  
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin  
Type “help”, “copyright”, “credits” or “license” for more information.  
Anaconda is brought to you by Continuum Analytics.  
Please check out: [http://continuum.io/thanks](http://continuum.io/thanks) and [https://anaconda.org](https://anaconda.org)

> > > import ROOT  
> > > Fatal Python error: PyThreadState\_Get: no current thread

Abort trap: 6  
[/code]

then I tried the suggestion here:

[code]root-v6-06-02$ install\_name\_tool -change libpython2.7.dylib /anaconda/lib/libpython2.7.dylib lib/libPyROOT.so

root-v6-06-02$ python  
Python 2.7.11 |Anaconda 2.5.0 (x86\_64)| (default, Dec 6 2015, 18:57:58)  
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin  
Type “help”, “copyright”, “credits” or “license” for more information.  
Anaconda is brought to you by Continuum Analytics.  
Please check out: [http://continuum.io/thanks](http://continuum.io/thanks) and [https://anaconda.org](https://anaconda.org)

> > > import ROOT  
> > > [/code]

I had the same issue with the ./configure make approach (different directory

```auto
root_git$ ./configure --enable-roofit --enable-rpath --enable-mathmore --enable-fftw3 --enable-python --enable-tmva --with-python-incdir=/anaconda/include/python2.7/ --with-python-libdir=/anaconda/lib/

root_git$ make -j4

root_git$ source bin/thisroot.sh 
root_git$ python
Python 2.7.11 |Anaconda 2.5.0 (x86_64)| (default, Dec 6 2015, 18:57:58) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import ROOT
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6

root_git$ install_name_tool -change libpython2.7.dylib /anaconda/lib/libpython2.7.dylib lib/libPyROOT.so 
root_git$ python
Python 2.7.11 |Anaconda 2.5.0 (x86_64)| (default, Dec 6 2015, 18:57:58) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import ROOT
>>> 
```
