Please read tips for efficient and successful posting and posting code
ROOT Version: v6-20-06
Platform: MacOS Mojave 10.14.6 (x86_64)
Compiler: Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Python: 3.8.2 installed with pyenv
Hello!
I am trying to compile the latest stable version of ROOT on macOS Mojave with Python 3 support.
Just to be clear, I am doing this because a younger student in our lab has a MacBook Air and she needs to work with me on a Python 3 project. I am using a macOS virtual machine to understand how to help her set the environment up. I personally find OSX not very developer-friendly and just a castrated version of Linux (and I am being kind) but this is off-topic.
I would happily have her use the precompiled binaries but they are only compatible with Python 2.
I checked that I can install the precompiled binaries without issues and use them with the system Python version 2.7.16. However (even if it is not my final goal), if I try the precompiled binaries with Python 2.7.18 installed with pyenv, I get this error:
~ neo$ python Python 2.7.18 (default, Jun 15 2020, 20:54:34) [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)] on darwin Type “help”, “copyright”, “credits” or “license” for more information.
import ROOT Fatal Python error: PyThreadState_Get: no current thread Abort trap: 6
I have then tried to compile ROOT with Python 3.8.2 installed by pyenv and the compile seems to go smoothly but when I try to import ROOT hell breaks free:
$ python3
Python 3.8.2 (default, Jun 15 2020, 18:35:20)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.import ROOT
*** Break *** segmentation violation
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[] (no debug info)
[/Users/neo/ROOT/current/lib/libPyROOT.so] PyUnicode_InternFromString /var/folders/xk/88q4ph593qg8d0yxs33vdg0w0000gn/T/python-build.20200615182848.992/Python-3.8.2/Objects/unicodeobject.c:15323
[/Users/neo/ROOT/current/lib/libPyROOT.so] PyROOT::CreatePyStrings() (no debug info)
[/Users/neo/ROOT/current/lib/libPyROOT.so] PyInit_libPyROOT (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyImport_LoadDynamicModuleWithSpec (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _imp_create_dynamic (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] cfunction_vectorcall_FASTCALL (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] PyVectorcall_Call (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalCodeWithName (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyFunction_Vectorcall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] call_function (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] function_code_fastcall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] call_function (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] function_code_fastcall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] call_function (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] function_code_fastcall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] call_function (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] function_code_fastcall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] call_function (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] function_code_fastcall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] object_vacall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyObject_CallMethodIdObjArgs (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] PyImport_ImportModuleLevelObject (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalCodeWithName (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] PyEval_EvalCode (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] builtin_exec (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] cfunction_vectorcall_FASTCALL (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] PyVectorcall_Call (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalCodeWithName (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyFunction_Vectorcall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] call_function (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] function_code_fastcall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] call_function (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] function_code_fastcall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] call_function (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] function_code_fastcall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] call_function (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] function_code_fastcall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] object_vacall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyObject_CallMethodIdObjArgs (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] PyImport_ImportModuleLevelObject (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalCodeWithName (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] PyEval_EvalCode (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] builtin_exec (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] cfunction_vectorcall_FASTCALL (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] PyVectorcall_Call (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalCodeWithName (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyFunction_Vectorcall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] call_function (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] function_code_fastcall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] call_function (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] function_code_fastcall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] call_function (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] function_code_fastcall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] call_function (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] function_code_fastcall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] object_vacall (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyObject_CallMethodIdObjArgs (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] PyImport_ImportModuleLevelObject (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalFrameDefault (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] _PyEval_EvalCodeWithName (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] PyEval_EvalCode (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] PyRun_InteractiveOneObjectEx (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] PyRun_InteractiveLoopFlags (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] PyRun_AnyFileExFlags (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] Py_RunMain (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] pymain_main (no debug info)
[/Users/neo/.pyenv/versions/3.8.2/bin/python3] Py_BytesMain (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)
I have also tried to install Python using brew but I could not even compile ROOT in that way. To compile ROOT I use these commands:
pyenv shell 3.8.2
mkdir -p ROOT
cd ROOT
mkdir build
mkdir v6-20-06
git clone GitHub - root-project/root: The official repository for ROOT: analyzing, storing and visualizing big data, scientifically source
cd source
git checkout -b v6-20-06 v6-20-06
cd …/build
cmake -Dpython=On -Dminuit2=On -DCMAKE_INSTALL_PREFIX=${HOME}/ROOT/v6-20-06 -DPYTHON_EXECUTABLE=$(command -v python3) …/sources
In conclusion, my question is:
What is the best way to compile ROOT with Python 3 support on MacOS Mojave?