Import ROOT problem under cygwin

Dear all,

I compiled the current version (5.10) of root under cygwin using gcc following the instructions on Axel’s web page. root by itself seems to work fine as far as I can tell, but I have a problem, when importing the ROOT module into python (2.4):

[code]$ python
Python 2.4.1 (#1, May 27 2005, 18:02:40)
[GCC 3.3.3 (cygwin special)] on cygwin
Type “help”, “copyright”, “credits” or “license” for more information.

import ROOT

WICHMANN@mpyxwriko2 ~/My Documents/XFEL/Management/BudgetBook/Risk/RiskAnalysis
$ [/code]

As you see, python just stops without any complaint.

If I start root, I can get a python prompt and can run the same piece of code interactively without any problems:

$ root
FreeType Engine v2.1.9 used to render TrueType fonts.
Compiled on 17 March 2006 for win32gcc with thread support.

CINT/ROOT C/C++ Interpreter version 5.16.8, February 9, 2006
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] TPython::Prompt()                                                
>>> import ROOT

Any idea, why that is and how I can fix that? It’s not a big deal, since I can run my codes anyway, but I would need to do some extra coding when copying scripts from Linux, where I just run them from the command line, to windows/cygwin.

Thanks for your help,



the main difference that I see, is that in starting python directly, you choose the version; whereas by loading it into CINT, the dynamic linker chooses the version.

Can you check $ROOTSYS/lib/ with ldd, or objdump -p (or, given that this is windows, dumpobj) and see with which pythonx.y.dll it has been linked?

Wim (who doesn’t have a windows box handy)

Hi Wim,

gives a long, looonnnnnggggg screen dump, but I suppose the interesting line is this one:

	DLL Name: libpython2.4.dll

There should only be one python version on the machine, which is 2.4 and root was compiled against this version.

Thanks and cheers,



it’s probably a cygwin issue. This [] might well be related - to me it all points to the linker / dlopen. I cannot give you any better advice than the workaround you already have; well - my advice would have actually been to use win32gdk with the free (as in beer []) MS compiler kit.

Cheers, Axel.

Hi Axel,

I followed your advice and installed the win32gdk version of root (will probably run faster, since I avoid the cygwin overhead!?). I downgraded python from 2.4 to 2.3.5 since that’s what root seems to be linked against.

I also added the root/lib and root/bin dirs to PythonPath in the registry.

Unfortunately, I still have problems importing ROOT into python :frowning:

This is running the python shell in IDLE:

[code]>>> import ROOT

Traceback (most recent call last):
File “<pyshell#0>”, line 1, in -toplevel-
import ROOT
File “bin/”, line 74, in -toplevel-
from libPyROOT import *
ImportError: DLL load failed with error code 193


What am I missing?Any ideas?
Sorry for being a pain, but usually don’t do these things under windows so don’t have much experience in settign things up.

Thanks for your help,



193 means “… is not a valid Win32 application”. So Windows finds it, but it’s unhappy with what it finds. Could you check the file - I suppose it’s bin/libPyROOT.dll? (I don’t know which file python is trying to load - Wim?) Did you set ROOTSYS and PATH, so Windows and ROOT can find the files that libPyROOT depends on? ROOTSYS should be set in the windows format, e.g. C:\root.

Cheers, Axel.

Yes, I did set ROOTSYS and added %ROOTSYS%/bin (tried in addition %ROOTSYS%/lib also) to the path, but starting teh control panels -> System -> Advanced ->Enviroment Variables. Set them in the system wide section.

Since python finds “bin/”, I assume they are set correctly.
I also tried to copy everything that was libPyROOT related from /lib to /bin …
didn’t make a difference.

If I start root from the dos prompt and they try to get a python prompt, I get the explicit error message (bad image) you mentioned showing the full path.




what’s the file size? Is your disk full? Was there a problem downloading the distribution?


ok, finally I’m in business.

It seems like the problem was the order of the ROOTSYS/bin and ROOTSYS/lib dirs in the registry definition of the PythonPath.

Just the lib dir is not enough and you have to list the bin dir first and then the lib dir.

Now, it works like a charm … :slight_smile:

Of course, one is never happy. Any way to get root and python2.4 working together?

I tried the PyROOT24 replacements you posted in this thread, Axel:

but they gave me a error message about some entry point could not be found in libCore.dll … I assume those were for cygwin?

Thanks for your help and patients,



The dll you refer to is incompatible because ROOT used to build it and your ROOT version differ. I only have dlls for a debug build, so it’ll only work with the “win32gdk with debug symbols” binary. If that’s OK with you - did you install 5.10.00 or 5.10.00a? I’ll email the dlls, but I need your email address. You can contact me at

But I’m sure someone also has a 5.10 release PyROOT.dll built with MSVC7.1 and Python 2.4.

Cheers, Axel.

The win32gdk version 5.11/01 and linked with Python2.4.2
is available from the ROOT web site at


Thanks for the info, Rene! Installed the latest version and it all runs.