when I then run “root --notebook” and try “import ROOT” it fails:
ImportError: Failed to import libcppyy3_7. Please check that ROOT has been built for Python 3.7
which implies “root --notebook” tries to use python3, despite not supporting it. I have both python and python3 installed.
Is there no binary that supports python3 for MacBooks? Or is there a way to force root to use python, rather than python3, when running root --notebook?
Which version of Python 3 do you have? Not all minor versions are compatible with each other (e.g. if ROOT is built with Python 3.7, then it might not work if you have Python 3.8 installed).
So ROOT does not support python3 yet or I can in fact get binaries that support that on MAC OS? Else the only option right now is to compile ROOT from the source code and configure to use python 3?
So it seems its not possible to build 6.22.02 at all on mac os currently. I get the somewhat similar errors as seen here:
Trying the solution of dropping back to 6.20.06 works, but that version does not seem to support python3. At least I could not find any way to get it to build with python3 instead of python2. Is there some way? The instructions mention setting PYTHON_EXECUTABLE:
but this made no difference in my case. cmake still tries to use python 2.7.
which was built using git tag v6-22-02. The build worked without errors this time.
After building, if I run:
root --notebook
I still see the same errors in the notebook:
ImportError: Failed to import libcppyy3_7. Please check that ROOT has been built for Python 3.7
My cmake.log shows:
– Could NOT find Python3 (missing: Python3_NumPy_INCLUDE_DIRS NumPy) (found version “3.8.2”)
– Found Python2: /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 (found version “2.7.16”) found components: Interpreter Development NumPy
– ROOT default compression algorithm: zlib
– PyROOT will be built for versions 3.8.2 (Main) and 2.7.16
My default python3 is 3.7.0 though:
python3 --version
Python 3.7.0
I also have:
ls /opt/local/bin/python3.8
/opt/local/bin/python3.8
so ROOT has built with 3.8, but the laptop is using 3.7 as the default (python 3.8 does not even show up in tab complete).
I think I somehow need to get ROOT to build with 3.7, not 3.8? Presumably this might be controlled by
some environment variables I could/should adjust.
– Found Python3: /usr/local/bin/python3 (found version “3.7.0”) found components: Interpreter Development NumPy
– Found Python2: /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 (found version “2.7.16”) found components: Interpreter Development NumPy
– ROOT default compression algorithm: zlib
– PyROOT will be built for versions 3.7.0 (Main) and 2.7.16
Hopefully things would now work after I build again…
It looks like this time CMake found 3.7 and therefore it will build PyROOT for that version (before it was building for 3.8, hence the error). Please let us know if that is not the case.