scikit-hep / root_numpy

The interface between ROOT and NumPy

Home Page:http://scikit-hep.org/root_numpy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiling/Installing root_numpy in Mac OS Sierra fails

malleite opened this issue · comments

Hi,

I had some trouble getting root_numpy running on mac os sierra ... I had a previous instalation that worked ok before the upgrade. I am using the stock dmg package from root 6.06.08 (works fine inside python) and the root numpy 1.11.2 . Python is the Mac (stock) python 2.7.10 .

  1. Trying to compile the latest version 4.6.0 from git fails during the library link stage (it understands that the code was compile for i386 while the root libraries are compiled for x86_64)
    --> Got it compiling right without this problem doing env ARCHFLAGS="-arch x86_64" python setup.py build .
    Without it, it includes both arch i386 and arch x86_64 during compilation and linking, which I believe was the cause of the error.

  2. If I try to import root_numpy , then I have the following error

ImportError: dlopen(/Users/leite/Library/Python/2.7/lib/python/site-packages/root_numpy-4.6.0.dev0-py2.7-macosx-10.12-intel.egg/root_numpy/_librootnumpy.so, 2): Library not loaded: @rpath/libHist.so
Referenced from: /Users/leite/Library/Python/2.7/lib/python/site-packages/root_numpy-4.6.0.dev0-py2.7-macosx-10.12-intel.egg/root_numpy/_librootnumpy.so
Reason: image not found

----> This was fixed by doing

install_name_tool -add_rpath /Applications/root_v6.06.08/lib/ ~/Library/Python/2.7/lib/python/site-packages/root_numpy-4.6.0.dev0-py2.7-macosx-10.12-intel.egg/root_numpy/_librootnumpy.so

install_name_tool -add_rpath /Applications/root_v6.06.08/lib/ ~/Library/Python/2.7/lib/python/site-packages/root_numpy-4.6.0.dev0-py2.7-macosx-10.12-intel.egg/root_numpy/tmva/_libtmvanumpy.so

Now I can run it and it passed all nose tests ....
I am not sure if this is the right way to get it working , but perhaps the installation needs a special tunning for MacOS to avoid these extra steps. (I also use Linux, and the install (or pip) works fine there ) .

Regards,
Marco

Hi @malleite ,

I ran into the same issue once, but it did not have much to do with the version of OS X (or macOS). Rather, the build of root_numpy would always occur against the wrong numpy. Enough cleaning out of dependencies fixed that.

However, one caveat with that: I never compiled from scratch but always relied on pip to do this for me.

Kind regards,
Geert-Jan

Hi @gbesjes ,

Thanks for the comment. In fact I switched to compile root_numpy due to a problem when installing it via pip in MacOS

_ImportError: dlopen(/Users/leite/Library/Python/2.7/lib/python/site-packages/root_numpy/_librootnumpy.so, 2): Library not loaded: @rpath/libHist.so
Referenced from: /Users/leite/Library/Python/2.7/lib/python/site-packages/root_numpy/librootnumpy.so
Reason: image not found

Maybe if I do the last step with install_name_tool (as I put in my previous email) this could be fixed ...

Best regards,
Marco

Is this now somewhat resolved? Looks like the env might be cluttered with multiple inconsistent versions of python, numpy etc. Or maybe we are now missing some mac-specific compiler options. But setup.py should be automatically handling that based on what python was compiled with.

Closing for now