# pyRoot on OS X Maverick

**URL:** <https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820>\
**Category:** ROOT\
**Created:** [October 29, 2013, 7:32pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820 "2013-10-29T19:32:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![marktobin1976](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@marktobin1976](https://root-forum.cern.ch/u/marktobin1976)\
**Post date:** [October 29, 2013, 7:32pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/1 "2013-10-29T19:32:10Z")

</div>

Hello, I managed to compile / install a version on root on OS X Maverick with the following steps:

```auto
git clone http://root.cern.ch/git/root.git temp/ROOT
cd temp/ROOT/
git checkout -t origin/v5-34-00-patches
./configure --all
make
. bin/thisroot.sh 
```

The installation seems to work. However, when I try

```auto

```

I get the following error:

```auto
>>> import ROOT
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/tobin/temp/ROOT/lib/ROOT.py", line 257, in <module>
    _root.gPad = _ExpandMacroFunction( "TVirtualPad", "Pad" )
  File "/Users/tobin/temp/ROOT/lib/ROOT.py", line 237, in __init__
    c = _root.MakeRootClass( klass )
AttributeError: type object 'string' has no attribute 'c_str'
```

The following, however, works fine:

```auto

```

Do you know why?

Thanks,  
Mark

---

<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:** [October 29, 2013, 9:32pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/2 "2013-10-29T21:32:18Z")

</div>

Mark,

as also per the other topic … I’ve not completely moved to 10.9 yet; once there I can test.

Cheers,  
Wim

---

<div class="post-metadata">

**Author:** ![deil](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/deil/32/11212_2.png) [@deil](https://root-forum.cern.ch/u/deil)\
**Post date:** [November 3, 2013, 3:14pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/3 "2013-11-03T15:14:05Z")

</div>

This issue is still present in ROOT v5-34-11 on OS X 10.9.  
In IPython the error looks like this:  
[gist.github.com/cdeil/7291259](https://gist.github.com/cdeil/7291259)

---

<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:** [November 3, 2013, 11:06pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/4 "2013-11-03T23:06:29Z")

</div>

Hi,

fixed in v5-34-00-patches. The dictionary for ‘std::string’ is not loaded (and std::string isn’t available in the first place, only ‘string’ which is also a python module, hence that specific error as the module hasn’t a c\_str()).

Cheers,  
Wim

---

<div class="post-metadata">

**Author:** ![johahe](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/johahe/32/11563_2.png) [@johahe](https://root-forum.cern.ch/u/johahe)\
**Post date:** [November 4, 2013, 7:09pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/5 "2013-11-04T19:09:46Z")

</div>

Another problem I have encountered is that .Draw() is not showing the XQuartz window. However .Print(“xy.pdf”) works fine.

example:

```auto
import ROOT as rt

c = rt.TCanvas("", "", 700, 500)
a = rt.TH1F("a", "a", 10, 0, 2)
a.Draw()
raw_input()
c.Print("a.pdf")
```

I get no error, just

```auto
# python test.py

Info in <TCanvas::Print>: pdf file a.pdf has been created
```

---

<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:** [November 4, 2013, 7:17pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/6 "2013-11-04T19:17:18Z")

</div>

Hi,

that’s odd, as a TCanvas was one of the things that I tried. Did you configure for cocoa? If so, can you try this option of driving the GUI instead (should be the first lines):`import ROOT
ROOT.PyConfig.StartGuiThread = 'inputhook'`  
Cheers,  
Wim

---

<div class="post-metadata">

**Author:** ![johahe](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/johahe/32/11563_2.png) [@johahe](https://root-forum.cern.ch/u/johahe)\
**Post date:** [November 4, 2013, 8:20pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/7 "2013-11-04T20:20:33Z")

</div>

I did not enable anything special, I just did a plain

> [@](#):
>
> ./configure macosx64; make

---

<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:** [November 4, 2013, 9:23pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/8 "2013-11-04T21:23:29Z")

</div>

Hi,

okay, but did setting the option help?

I’ll try again myself once I’m behind a Mac.

Cheers,  
Wim

---

<div class="post-metadata">

**Author:** ![johahe](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/johahe/32/11563_2.png) [@johahe](https://root-forum.cern.ch/u/johahe)\
**Post date:** [November 4, 2013, 10:36pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/9 "2013-11-04T22:36:55Z")

</div>

I tried it, but it changed nothing. It’s really strange that I get no errors while I don’t even see the window pop up, when I create a new TCanvas.  
I’ll try to configure for cocoa tomorrow, maybe that will work.

---

<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:** [November 5, 2013, 6:53am UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/10 "2013-11-05T06:53:02Z")

</div>

Hi,

btw., does root.exe show a window for you? Or for that matter xclock or any simple application? I.e., is it an XQuartz problem or a Python problem? When searching the interwebs, I’m finding several reports of X11 applications having trouble and the only remedy posed seems to be to reinstall XQuartz (presumably this restores/recreates some files that the update destroyed).

Cheers,  
Wim

---

<div class="post-metadata">

**Author:** ![johahe](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/johahe/32/11563_2.png) [@johahe](https://root-forum.cern.ch/u/johahe)\
**Post date:** [November 5, 2013, 7:41am UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/11 "2013-11-05T07:41:27Z")

</div>

I just tried to create a TCanvas in the root interpreter, it shows up as expected. But if I want to draw something to that Canvas, I get the same error as in this thread [Linker problem with Mac OS 10.9 and libAfterImage](https://root-forum.cern.ch/t/linker-problem-with-mac-os-10-9-and-libafterimage/16816/1)

[quote=“dhill”]I’m not sure why it won’t work in my case, strange…

Just to document what I see currently, I get the error message:

\*\*\* Break \*\*\* bus error  
Generating stack trace…  
0x000000010d6ec5e2 in TGX11TTF::RenderString(int, int, TVirtualX::ETextMode) (in [libGX11TTF.so](http://libGX11TTF.so)) + 706  
0x000000010a980645 in TPad::PaintText(double, double, char const\*) (in [libGpad.so](http://libGpad.so)) + 101  
0x000000010a592fbf in TLatex::Analyse(double, double, TextSpec\_t, char const\*, int) (in [libGraf.so](http://libGraf.so)) + 46063  
0x000000010a594e23 in TLatex::PaintLatex(double, double, double, double, char const\*) (in [libGraf.so](http://libGraf.so)) + 4147  
0x000000010a57e91a in TGaxis::PaintAxis(double, double, double, double, double&, double&, int&, char const\*, double, bool) (in [libGraf.so](http://libGraf.so)) + 27274  
0x0000000151a3b376 in THistPainter::PaintAxis(bool) (in [libHistPainter.so](http://libHistPainter.so)) + 2102  
0x0000000151a3a23a in THistPainter::Paint(char const\*) (in [libHistPainter.so](http://libHistPainter.so)) + 1866  
0x000000010a97d369 in TPad::Paint(char const\*) (in [libGpad.so](http://libGpad.so)) + 601  
0x000000010a97d369 in TPad::Paint(char const\*) (in [libGpad.so](http://libGpad.so)) + 601  
0x000000010a9826d9 in TPad::Print(char const\*, char const\*) (in [libGpad.so](http://libGpad.so)) + 6121  
0x000000010a983a2d in TPad::SaveAs(char const\*, char const\*) const (in [libGpad.so](http://libGpad.so)) + 1021  
0x0000000108b44c1a in Fitting::RunFullFit(bool) (in run) (Fitting.C:1156)  
0x0000000108b357d9 in Fitting::Fitting(Parameters\*, TApplication\*) (in run) (Fitting.C:160)  
0x0000000108b2a974 in main (in run) (ostream:1180)  
0x00007fff910185fd in start (in libdyld.dylib) + 1  
0x0000000000000009 in

right at the point where my code attempts to draw stuff onto a TCanvas. It creates the TCanvas objects and I see them blank on my screen, but it crashes shortly after.[/quote]

edit to answer your post: XQuartz is working with other applications, I don’t think this is the problem.

---

<div class="post-metadata">

**Author:** ![jvantilb](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/ee7513/32.png) [@jvantilb](https://root-forum.cern.ch/u/jvantilb)\
**Post date:** [November 6, 2013, 10:30am UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/12 "2013-11-06T10:30:39Z")

</div>

Hi,

I have the same problem: after installing the latest root-v5-34-00-patches, I do not get any X windows in python. So when I do:

```auto
from ROOT import *
TBrowser()
```

Nothing happens. I tried the suggestion from Wim to drive the GUI (I tried this both for XQuartz and cocoa), but that does not help either.

Any suggestion is much appreciated.

Jeroen

---

<div class="post-metadata">

**Author:** ![dougutphy](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/258eb7/32.png) [@dougutphy](https://root-forum.cern.ch/u/dougutphy)\
**Post date:** [November 6, 2013, 5:11pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/13 "2013-11-06T17:11:47Z")

</div>

I’m having the same problem as jvantilb on the 5-34-00-patches release

I’ve also installed through macports – This leads to the having to import ROOT twice problem,  
I added the lines:

```auto
   if sys.platform == 'darwin':                                                                                        
     _root.gROOT.ProcessLine( '#include <string>' )   
```

in class std( object ) (about line 228) in [ROOT.py](http://ROOT.py)  
which solves the import ROOT twice issue, but then XQuartz does not open, similar to the 5-34-00 patches problem

---

<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:** [November 6, 2013, 5:47pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/14 "2013-11-06T17:47:13Z")

</div>

Hi,

can each who has issues with X11 verify their config.status to see where X11 headers and libs are picked up from? I’ve a problem Mac where they are picked up from an old (pre-Mavericks) Macports installation. Might be the reason.

Cheers,  
Wim

---

<div class="post-metadata">

**Author:** ![johahe](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/johahe/32/11563_2.png) [@johahe](https://root-forum.cern.ch/u/johahe)\
**Post date:** [November 6, 2013, 5:57pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/15 "2013-11-06T17:57:35Z")

</div>

[quote=“wlav”]Hi,

can each who has issues with X11 verify their config.status to see where X11 headers and libs are picked up from? I’ve a problem Mac where they are picked up from an old (pre-Mavericks) Macports installation. Might be the reason.

Cheers,  
Wim[/quote]

I did a clean install of OS X Mavericks, Command Line Tools and XQuartz. I don’t think that’s the issue.

./configure macosx64 --all: [http://nopaste.me/paste/59816096527a8996c0b2e](http://nopaste.me/paste/59816096527a8996c0b2e)

```auto
➜ root git:(v5-34-00-patches) # ls -l /usr/X11*
lrwxr-xr-x 1 root wheel 8 2 Nov 10:00 /usr/X11 -> /opt/X11
lrwxr-xr-x 1 root wheel 8 2 Nov 10:00 /usr/X11R6 -> /opt/X11
```

---

<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:** [November 6, 2013, 6:00pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/16 "2013-11-06T18:00:32Z")

</div>

Hi,

which version of XQuartz do you have? Their docs ([xquartz.macosforge.org/trac/wiki](http://xquartz.macosforge.org/trac/wiki)) say:[quote]Mavericks users, please use 2.7.5 rc3 or later.[/quote]  
Cheers,  
Wim

---

<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:** [November 6, 2013, 6:03pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/17 "2013-11-06T18:03:34Z")

</div>

Btw., I just reinstalled XQuartz and now at least xclock works. No root.exe or PyROOT windows, though.

Cheers,  
Wim

---

<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:** [November 6, 2013, 6:09pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/18 "2013-11-06T18:09:41Z")

</div>

Hi,

here is something: for whatever reason, when I start PyROOT, I get this:[code]\>\>\> import ROOT

> > > print ROOT.gROOT.IsBatch()  
> > > True  
> > > [/code]  
> > > Even more surprising, when I do:`>>> import ROOT
> > > ROOT.gROOT.SetBatch(False)
> > > c = TCanvas()`  
> > > everything seems to work fine.

No idea why the default setting has changed in side ROOT or what is causing that change.

Note that this is after reinstalling XQuartz (2.7.5 rc4), so that may have had other effects (before xclock didn’t work for me either, for example).

Cheers,  
Wim

---

<div class="post-metadata">

**Author:** ![johahe](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/johahe/32/11563_2.png) [@johahe](https://root-forum.cern.ch/u/johahe)\
**Post date:** [November 6, 2013, 6:50pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/19 "2013-11-06T18:50:08Z")

</div>

[quote=“wlav”]  
Even more surprising, when I do:[code]\>\>\> import ROOT

> > > ROOT.gROOT.SetBatch(False)  
> > > c = TCanvas()[/code]  
> > > everything seems to work fine.[/quote]  
> > > Yes, I that works, but try to draw something to that TCanvas

```auto
import ROOT
ROOT.gROOT.SetBatch(False)
c = ROOT.TCanvas()
h = ROOT.TH1F()
h.Draw()
```

I use XQuartz 2.7.5 rc4.

---

<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:** [November 6, 2013, 7:10pm UTC](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820/20 "2013-11-06T19:10:55Z")

</div>

Hi,

I’ll try later … currently everything is broken while I’m trying to upgrade ports. I had to give up, wipe the system, and start over. May take a bit, as I won’t be behind a mac for the rest of the day.

Cheers,  
Wim

[Next page](https://root-forum.cern.ch/t/pyroot-on-os-x-maverick/16820.md?page=2)
