PyROOT with Anaconda Python 3.6 with ROOT 6.12.04


_ROOT Version:6.12.04
_Platform:MacOS Sierra 10.12.6
_Compiler: gcc 4.2.1


I have been trying to install pyroot with python 3.6.5 installed from Anaconda on MacOS Sierra. Every time
, in python, I got the error message attached in the end. This is an identical problem in PyRoot crashes with ROOT 6.11/02 and Python3 The original author didn’t comment on whether he/she fixed the problem. However, the discussion ended where another person having the same issue.
I did try all the suggestions mentioned there. I install via
cmake -DPYTHON_EXECUTABLE=/Users/myusername/anaconda3/bin/python3.6 ~/Downloads/root-6.12.04/
and I also tried
cmake -Dall=On -DPYTHON_EXECUTABLE=/Users/myusername/anaconda3/bin/python -DPYTHON_INCLUDE_DIR=/Users/myusername/anaconda3/include/python3.6m -DPYTHON_LIBRARY=/Users/myusername/anaconda3/lib/libpython3.6m.dylib -Dpython3=ON ~/Downloads/root-6.12.04/

To make sure I have the same python/compiler version. This is the output from python:
$python Python 3.6.5 |Anaconda, Inc.| (default, Apr 26 2018, 08:42:37) [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin

while gcc --version gave me
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-darwin16.7.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

For python related path in CMakeCache.txt are:
PYTHON_EXECUTABLE:FILEPATH=/Users/myusername/anaconda3/bin/python PYTHON_EXECUTABLE-CACHED:STRING=/Users/myusername/anaconda3/bin/python PYTHON_INCLUDE_DIR:PATH=/Users/myusername/anaconda3/include/python3.6m PYTHON_INCLUDE_DIR-CACHED:STRING=/Users/myusername/anaconda3/include/python3.6m PYTHON_LIBRARY:FILEPATH=/Users/myusername/anaconda3/lib/libpython3.6m.dylib PYTHON_LIBRARY-CACHED:STRING=/Users/myusername/anaconda3/lib/libpython3.6m.dylib PYTHON_LIBRARY_DEBUG:FILEPATH=PYTHON_LIBRARY_DEBUG-NOTFOUND
All of them correctly point to anaconda python 3.6. Did I do anything wrong?

The same issue also appeared in here. One person suggested to check the compiler. However, the original author solved the problem by abandoning anaconda.

Below is the error message from import ROOT

*** Break *** segmentation violation
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[<unknown binary>] (no debug info)
[/Users/myusername/anaconda3/lib/libpython3.6m.dylib] PyUnicode_InternFromString (no debug info)
[/Users/myusername/local/root-6.12.04/lib/libPyROOT.so] PyROOT::CreatePyStrings() /Users/myusername/Downloads/root-6.12.04/bindings/pyroot/src/PyStrings.cxx:64
[/Users/myusername/local/root-6.12.04/lib/libPyROOT.so] PyInit_libPyROOT /Users/myusername/Downloads/root-6.12.04/bindings/pyroot/src/RootModule.cxx:848
[/Users/myusername/anaconda3/bin/python] _PyImport_LoadDynamicModuleWithSpec (no debug info)
[/Users/myusername/anaconda3/bin/python] _imp_create_dynamic (no debug info)
[/Users/myusername/anaconda3/bin/python] PyCFunction_Call (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalCodeWithName (no debug info)
[/Users/myusername/anaconda3/bin/python] fast_function (no debug info)
[/Users/myusername/anaconda3/bin/python] call_function (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] fast_function (no debug info)
[/Users/myusername/anaconda3/bin/python] call_function (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] fast_function (no debug info)
[/Users/myusername/anaconda3/bin/python] call_function (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] fast_function (no debug info)
[/Users/myusername/anaconda3/bin/python] call_function (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] fast_function (no debug info)
[/Users/myusername/anaconda3/bin/python] call_function (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyFunction_FastCallDict (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyObject_FastCallDict (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyObject_CallMethodIdObjArgs (no debug info)
[/Users/myusername/anaconda3/bin/python] PyImport_ImportModuleLevelObject (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalCodeWithName (no debug info)
[/Users/myusername/anaconda3/bin/python] builtin_exec (no debug info)
[/Users/myusername/anaconda3/bin/python] PyCFunction_Call (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalCodeWithName (no debug info)
[/Users/myusername/anaconda3/bin/python] fast_function (no debug info)
[/Users/myusername/anaconda3/bin/python] call_function (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] fast_function (no debug info)
[/Users/myusername/anaconda3/bin/python] call_function (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] fast_function (no debug info)
[/Users/myusername/anaconda3/bin/python] call_function (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] fast_function (no debug info)
[/Users/myusername/anaconda3/bin/python] call_function (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyFunction_FastCallDict (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyObject_FastCallDict (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyObject_CallMethodIdObjArgs (no debug info)
[/Users/myusername/anaconda3/bin/python] PyImport_ImportModuleLevelObject (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalCodeWithName (no debug info)
[/Users/myusername/anaconda3/bin/python] builtin_exec (no debug info)
[/Users/myusername/anaconda3/bin/python] PyCFunction_Call (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalCodeWithName (no debug info)
[/Users/myusername/anaconda3/bin/python] fast_function (no debug info)
[/Users/myusername/anaconda3/bin/python] call_function (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] fast_function (no debug info)
[/Users/myusername/anaconda3/bin/python] call_function (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] fast_function (no debug info)
[/Users/myusername/anaconda3/bin/python] call_function (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] fast_function (no debug info)
[/Users/myusername/anaconda3/bin/python] call_function (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyFunction_FastCallDict (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyObject_FastCallDict (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyObject_CallMethodIdObjArgs (no debug info)
[/Users/myusername/anaconda3/bin/python] PyImport_ImportModuleLevelObject (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalFrameDefault (no debug info)
[/Users/myusername/anaconda3/bin/python] _PyEval_EvalCodeWithName (no debug info)
[/Users/myusername/anaconda3/bin/python] PyRun_InteractiveOneObjectEx (no debug info)
[/Users/myusername/anaconda3/bin/python] PyRun_InteractiveLoopFlags (no debug info)
[/Users/myusername/anaconda3/bin/python] PyRun_AnyFileExFlags (no debug info)
[/Users/myusername/anaconda3/bin/python] Py_Main (no debug info)
[/Users/myusername/anaconda3/bin/python] main (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)
[<unknown binary>] (no debug info)

You are right for me installation of ROOT with Anaconda did not work. I guess neither ROOT nor Anaconda want to be compatible to each other. I have installed python 3.6.4 directly from python.org and it works with ROOT 6.12/06. I currently do not see disadvantage of having non anaconda python.

For the records here was my procedure:

I have removed the anaconda3 directory as well as the conda hidden files. My .bash_profile has only this in the path:

/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin

Configure:


cmake \

-DCMAKE_INSTALL_PREFIX=/Users/hits/Applications/root6/install/ \

-Dpython3=On -DPYTHON_EXECUTABLE=/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 \

../root/

cmake does find all the right python stuff:


-- Looking for Python

-- Found PythonInterp: /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 (found suitable version "3.6.4", minimum required is "3.5")

-- Found Python interpreter version 3.6

-- Found PythonLibs: /Library/Frameworks/Python.framework/Versions/3.6/lib/libpython3.6m.dylib (found version "3.6.4")

-- Found PythonInterp: /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 (found version "3.6.4")

-- Found NUMPY: /Users/hits/Library/Python/3.6/lib/python/site-packages/numpy/core/include (found version "1.14.1")

build it:

cmake --build . --target install

Installation proceeds ok with only one error, which I have learned should be a warning:

error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: for: /Users/hits/Applications/root6/install/bin/hist2workspace (for architecture x86_64) option "-add_rpath @loader_path/../lib" would duplicate path, file already has LC_RPATH for: @loader_path/../lib

Next I do:


$ source ../install/bin/thisroot.sh

$ which root

/Users/hits/Applications/root6/install/bin/root

root starts up without problems:


$ root

conda/anaconda is a bad implementation of an even worse idea that on top is full of bugs, so good luck with that.

But fundamentally, you have to understand that you are trying to build ROOT in the anaconda run-time environment, which is not the environment in which anaconda packages themselves were configured and build, so the information needed for proper configuration is not made available by anaconda. Worse, if such configuration is available anywhere on the system, it will be for system packages. That will be silently picked up and used, with virtually zero chance of being correct.

It gets worse if you are tempted to pull in packages from other channels. I’m thinking e.g. of a modern cmake, where anaconda only since a few weeks has a recent version, but conda-forge has had one for quite a while. Problem is, conda-forge and anaconda are not compatible. Gets more worse as you add more channels.

What you have to do is first of all update your Xcode (your compiler is out of date), then a) stick to a pure, vanilla, anaconda environment; b) setup the run-time environment with the build-time dependencies of all packages you care about (i.e. everything that ROOT would pick up from the anaconda build installation of all dependent packages) but only from anaconda, no other channels; and c) install in the build directory, do not relocate, do not switch conda environments (or (re)build ROOT for each).

That actually works. Or at least for a minimal version of ROOT+python with use of all of ROOT’s own builtins enabled. In fact, if you do this within the conda-build environment, disable binary patching, remove a few headers that cling pulls in, and disable use of ncurses by llvm, you can even create a portable conda package out of that!

Or, use a real package manager such as macports, homebrew, fink, or what-have-you. In which case it’s just cmake ../root and you’re off to the races.

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