ROOT 5.14d and PyROOT with Python 2.5

Hi,

I’m on windows with VC++ 7.1. I built ROOT 5.14d myself on my windows box against Python 2.5. The compilation seemed to go just fine, and I have libPyRoot.dll and libPyRoot.lib in the bin and lib directories. A problem occurs if I try to import ROOT into python:

C:>set PYTHONPATH=%ROOTSYS%\bin;%ROOTSYS%\lib

C:>python %ROOTSYS%\tutorials\pyroot\demo.py
Traceback (most recent call last):
File “C:\heather\glast\extlib\ROOT\v5.14.00d\vc8\tutorials\pyroot\demo.py”, line 2, in
import ROOT
File “C:\heather\glast\extlib\ROOT\v5.14.00d\vc8\bin\ROOT.py”, line 83, in
import libPyROOT as _root
ImportError: No module named libPyROOT

I’ve gone back to the binary distribution of ROOT v5.14 for windows and Python 2.4 and trying the same experiment, the demos start up just fine. Is there something more I should do beyond enabling python during my ROOT build? Or is there something particularly wrong with trying to go with Python 2.5 on windows?

Thanks,
Heather

I should probably add how I’m compiling ROOT. My version is built against VC++ 7.1, using cygwin:

./configure win32 --enable-roofit --enable-minuit2 --enable-table
–enable-python --disable-odbc --enable-gdml
–enable-unuran --enable-xrootd
–with-fftw3-incdir=C:/heather/root-5.14d/fftw-3.1.2-dll
–with-fftw3-libdir=C:/heather/root-5.14d/fftw-3.1.2-dll
–with-gccxml=C:/heather/root-5.14d/gcc_xml
–with-xml-incdir=C:/heather/root-5.14d/libxml2-2.6.15.win32/include
–with-xml-libdir=C:/heather/root-5.14d/libxml2-2.6.15.win32/lib
–with-python-libdir=C:/Python25/libs
–with-python-incdir=C:/Python25/include

python2.5 is in my path, ROOTSYS\bin and ROOTSYS\lib are in my path and PYTHONPATH. ROOTBUILD is set to opt.

I’m hoping I did something obviously incorrect.

Take care,
Heather

Heather,

Wim will process your mail once he is back online, but please submit your
problems with python to the pyroot thread.

Rene

Hi Rene,

Ah, sorry, I’ll post to the python thread.

Thanks,
Heather

Heather,

staring at this for a bit (I have no Windows box to check), but is it really so that the libs that were built are called “libPyRoot.dll” and “libPyRoot.lib”? I know that the Windows filesystem per se is not case sensitive, but modern Windows OSes are case-preserving, no? If so, then the case will matter to python. Can you verify and rename if needed, see what it does? Thanks.

Cheers,
Wim

Hi Wim,

Thanks, unfortunately I was displaying my Windows-centric lack of concern for capitalization in my post. On my machine, the libraries really are libPyROOT as they should be.

Take care,
Heather

Heather,

just grabbing at straws here:

o) is the ‘vc8’ bit in the traceback (in %ROOTSYS%) correct? I.e. are you selecting the new build or the p2.4 install?

o) is libPyROOT.dll readable?

o) does dumpobj (or whichever the correct tool is on Windows) report missing symbols/libraries for libPyROOT.dll?

o) is “C:/Python25/bin” part of %PATH%?

Cheers,
Wim

Hi Wim,

I appreciate the ideas:

o) is the ‘vc8’ bit in the traceback (in %ROOTSYS%) correct? I.e. are you selecting the new build or the p2.4 install?[/quote]

ROOTSYS is set correctly - I tried on purpose to run Python 24 against my libPyRoot built against Python 2.5 - and python is quite clear when one is trying to load a library built against the wrong version of python.

o) is libPyROOT.dll readable?

yes

o) does dumpobj (or whichever the correct tool is on Windows) report missing symbols/libraries for libPyROOT.dll?

I used dependency walker - and that checked out just fine.

o) is “C:/Python25/bin” part of %PATH%?

Yes

So I went back and rebuilt ROOT v5.14e against Python 2.4.4 on my machine - and that turns out just fine. I can start up python and get demo.py to run. I then went and re-installed Python 2.5.1, fixed up my environment to use it appropriately, restarted the machine, and then rebuilt ROOT v5.14e from scratch. I also modified the path, so that no special characters appears in my ROOTSYS path at all. And when I go to load libPyROOT using Python 2.5.1 - I receive the same error as before.

So I’m wondering - has anyone out there built some version of ROOT v5.14 against Python 2.5 on Windows and gotten it to work?

Thanks,
Heather

Well, it seems I have the answer:

root.cern.ch/phpBB2/viewtopic.ph … e65253dc61

It seems ROOT.py on windows using python 2.5 requires something like this:

+if pystring.find( sys.platform, ‘win32’) == 0:

  • dllpath = os.path.join( os.getenv(‘ROOTSYS’), ‘bin’, ‘libPyROOT.dll’)
  • imp.load_dynamic(‘libPyROOT’, dllpath)

before:
import libPyROOT as _root

Maybe I could request that ROOT.py be updated in CVS (if it has not been already) so that future python 2.5 users on windows do not have to pull out their hair :slight_smile:

Take care,
Heather