Python and root

I have been trying to get python working with root on the mac unsuccessfully…

My latest attempt:

Install python from scratch version 3.3 which has never been installed on this mac before with:

sudo port install python33
sudo port select --set python python33

I now check that python picks up the right version, it seems to:

new-host:~ paula$ which python
new-host:~ paula$ ls -altr /opt/local/bin/python
lrwxr-xr-x 1 root admin 24 Jan 20 22:35 /opt/local/bin/python -> /opt/local/bin/python3.3

Then I download root from scratch and type:

./configure macosx64 --enable-python --with-python-incdir=/opt/local/Library/Frameworks/Python.framework/Versions/3.3/include/python3.3m/

Then I type

source bin/

all seems fine.

Then I go into python and try to import ROOT, does not work

Python 3.3.3 (default, Nov 23 2013, 13:21:35)
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

from ROOT import *
Traceback (most recent call last):
File “”, line 1, in
File “/Users/paula/Documents/newroot/root/lib/”, line 103, in
import libPyROOT as _root
ImportError: dynamic module does not define init function (PyInit_libPyROOT)

I would be very grateful if someone has simple instructions for how I can solve this

P.S. Things now got worse, I tried some variations on the above theme and get a compilation error as shown here. I’m totally stuck…

In file included from /Users/paula/Documents/newroot/root/graf2d/graf/src/TTF.cxx:23:
include/TTF.h:51:4: error: unknown type name ‘FT_Glyph’; did you mean ‘FTGlyph’?
FT_Glyph fImage; // glyph image
include/ftglyph.h:25:19: note: ‘FTGlyph’ declared here
In file included from /Users/paula/Documents/newroot/root/graf2d/graf/src/TTF.cxx:23:
include/TTF.h:51:15: error: field type ‘FTGlyph’ is an abstract class
FT_Glyph fImage; // glyph image
include/ftglyph.h:49:32: note: unimplemented pure virtual method ‘Render’ in 'FTGlyph’
virtual const FTPoint& Render( const FTPoint& pen) = 0;
2 errors generated.
make: *** [graf2d/graf/src/TTF.o] Error 1


I solved my problem (with help from others!) in the following way and record it in case someone else has problems with pyroot on mac.

  1. Set the python to python2.7 with the following command:

sudo port select --set python python27

check it is ok with

port select --list python

to see the active python

  1. Remove ALL definitions of ROOTSYS, PYTHONLIB etc. from the .profile

  2. Install python compatible root with macports (see the list with port variants root)
    sudo port install root +python27

That’s it, it works now….

This problem appeared because the latest freetype (the one macport installs) has changed the directory tree for its include files, which introduced a clash with a FTGL include files on Mac. It was enough to not expose the FTGL include files in $ROOTSY/include to fix that. Anyway FTGL include files should not be exposed in $ROOTSYS/include, because they are for internal use only. See: