Compiling ROOT 6.12/06 with anaconda python 3.6

Hi,

I have tried finding a recipe that works for using my anaconda python installation with ROOT 6.12/06 but without luck. Has anyone succeeded in doing so? My OS is OSX 10.13.3. The ROOT compiles and works without a problem, but when I start python and type:

import ROOT
it crashes with a nasty message:

*** Break *** segmentation violation
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[] (no debug info)
[/Users/hits/anaconda3/lib/libpython3.6m.dylib] PyUnicode_InternFromString (no debug info)
[/Users/hits/Applications/root/build_dir2/lib/libPyROOT.so] PyROOT::CreatePyStrings() /Users/hits/Applications/root/bindings/pyroot/src/PyStrings.cxx:64
[/Users/hits/Applications/root/build_dir2/lib/libPyROOT.so] PyInit_libPyROOT /Users/hits/Applications/root/bindings/pyroot/src/RootModule.cxx:848
[/Users/hits/anaconda3/bin/python] _PyImport_LoadDynamicModuleWithSpec (no debug info)
[/Users/hits/anaconda3/bin/python] _imp_create_dynamic (no debug info)
[/Users/hits/anaconda3/bin/python] PyCFunction_Call (no debug info)

I only pasted part of it here, because I do not see anything I can use there to figure out the problem. If someone else thinks that it may help to figure out the problem I will gladly paste the rest.

My setup was the following:

cmake -Dall=On -DPYTHON_EXECUTABLE=/Users/hits/anaconda3/bin/python -DPYTHON_INCLUDE_DIR=/Users/hits/anaconda3/include/python3.6m -DPYTHON_LIBRARY=/Users/hits/anaconda3/lib/libpython3.6m.dylib -Dpython3=ON …/

Does anyone see anything wrong with it?

anaconda python is my default python:
$ which python
/Users/hits/anaconda3/bin/python

Any help greatly appreciated!

Cheers,

Dmitry

May be @etejedor will have an idea about your problem.

Hi Dmitry,

The issue with PyROOT and anaconda, which is explained here:

https://sft.its.cern.ch/jira/browse/ROOT-9145

is that you need to compile ROOT with the same compiler that anaconda provides, if that is an option for you (that is, if the compiler is not too old).

Cheers,

Enric

Hi Enric,

Thank you! I will see if it works for me. Do you know by chance how to force cmake to choose the anaconda compiler? I have tried:
$source activate root
but cmake still picked the Xcode compiler.

Cheers,

Dmitry

Hi Dmitry,

Please have a look at:

https://root.cern.ch/building-root

In section Variables, I believe what you are looking for is CMAKE_CXX_COMPILER.

Cheers,

Enric

1 Like

After a week of trying different installation methods, I now think that it is impossible to install pyROOT with ROOT6 and with python3 on Mac OSX. And that it does not matter if it is the anaconda python or the python you get directly from python.org. I would be very interested if anyone can claim otherwise?

I also don’t think that the theory of the different compilers is correct:

My default compiler is 4.2.1

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin17.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

which is exactly the same as the compiler for anaconda python:

$python
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 12:04:33)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin

Cheers,

Dmitry

1 Like

Hi Dmitry,

What is exactly the issue you have with Python3 (non-anaconda) on MacOSX? That combination is certainly possible. Could it be that there is some interference with the anaconda Python?

Cheers,

Enric

Hi Enric,

The crash was exactly the same as for the anaconda python (as you see in my first post). For that experiment, I removed the anaconda python completely. I can try it again and report here all the steps. Maybe you’ll see something wrong with them.

By the way, my crash is somewhat different from what you had. I get failure similar to yours when I also put python libs in DYLD_LIBRARY_PATH.

Cheers,

Dmitry

Hi Dmitry,

Yes please post your steps and the final stack trace. Also please attach the CMakeCache.txt file that is created in your build directory so that we can check the Python-related variables.

Cheers,

Enric

Hi Enric,

I take it back. This time it works with the python3.6.4 installed from python.org!

I am not sure what did it. Maybe the fact that I updated some libraries with homebrew in the meanwhile.

Thanks for your reply, I wouldn’t have tried it again otherwise!

Cheers,

Dmitry

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.