10.6 Binary with Python broken?

Dear all,

There seems to be some weird voodoo with OSX 10.6 and 32bit/64bit python/ROOT/etc.

If I compile root from source with the enable-python flag, I have complete success using pyroot.

However, if I download either of the 5.27 binaries:

Mac OS X 10.6 Intel 64-bit and gcc 4.2.1, version 5.27/02

Mac OS X 10.6 Intel and gcc 4.2.1, version 5.27/02

they work out of the box – except doing >>>import ROOT in python gives an architecture error for the 32 bit binary. I have a 32 bit intel processor, yet only the 64 bit binary of ROOT works.

Am I missing something here??

Thanks,

James

Hi,

I don’t see the problem with the machine on which ROOT has been built:

[macphsft02:~/ROOT/i386-mac106-gcc42-opt] bellenot% which python
/afs/cern.ch/sw/lcg/external/Python/2.6.2/i386-mac106-gcc42-opt//bin/python
[macphsft02:~/ROOT/i386-mac106-gcc42-opt] bellenot% python
Python 2.6.2 (r262:71600, Apr 20 2010, 10:21:06)
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>>

For info, i386-mac106-gcc42-opt is a 32bit architecture… Anyway, we’ll try on another machine and we’ll let you know.

Cheers, Bertrand.

Hi again,

If you have a 32 bit processor, how did you try the 64 bit version?
The problem is that on MAC OSX 10.6, Python binaries are 64 bit and 32 bit compatible. Then it is very difficult to test 32 bit only, unless to have a 32 bit processor… Anyway, I’ll try to see what is going wrong.
At least, you were able to solve the problem by building Root from source…

Cheers, Bertrand.

Hi, thanks for the reply–

There are several Macs in our lab, and we’ll be getting a few more soon, so it would be nice to figure out how to use the binaries so I don’t have to build ROOT on them all :slight_smile: which is the only reason I bring it up.

So, to start I have a Macbook with OSX 10.6.3

Darwin james-wetzels-macbook-3.local 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386

By default, my computer came with Python 2.6.1. If I download the 32 bit binary of ROOT this happens:

james-wetzels-macbook-3:pyroot jwwetzel$ /usr/bin/pythonw
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "lib/ROOT.py", line 86, in <module>
    import libPyROOT as _root
ImportError: dlopen(/Applications/root/lib/libPyROOT.so, 2): no suitable image found.  Did find:
	/Applications/root/lib/libPyROOT.so: mach-o, but wrong architecture
	/Applications/root/lib/libPyROOT.so: mach-o, but wrong architecture
	/Applications/root/lib/libPyROOT.so: mach-o, but wrong architecture

Now, libPyRoot.so is:

james-wetzels-macbook-3:pyroot jwwetzel$ lipo -info /Applications/root/lib/libPyROOT.so 
Non-fat file: /Applications/root/lib/libPyROOT.so is architecture: i386

james-wetzels-macbook-3:pyroot jwwetzel$ lipo -info /Applications/root/bin/root
Non-fat file: /Applications/root/bin/root is architecture: i386

If I update Python to 2.6.5:

Python 2.6.5 (r265:79359, Mar 24 2010, 01:32:55) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap

So I’m not sure what’s going on exactly.

I just downloaded the 64 binary, unpacking and running root works fine.

I must be doing something silly??

Cheers,

James

Hi James,

OK, I’ll check with our Mac expert as soon as he’s back and we’ll keep you in touch.

Cheers, Bertrand.

James,

Then you actually have a 64 bit Mac (otherwise you wouldn’t be able to run 64 bit Root). To be sure, just select “About this Mac” from the Apple top left menu: if it says Intel CORE 2 Duo, it IS a 64 bit CPU!
And the problem you have is the following: you run your local python, which is 64 bit, and try to load a 32 bit libPyROOT.so, hence the “wrong architecture” error message.
So here is the main question: why aren’t you using the 64 bit Root binaries?
If you really want to use 32 bit one, you have to use the full dependencies chain in 32 bit. That mean you have to find (or build) a 32 bit python…

Cheers, Bertrand.