Home | News | Documentation | Download

ImportError: Failed to import libcppyy3_7. Please check that ROOT has been built for Python 3.7

Hello,

I installed the binary from:

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?

Cheers,

Mark


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


@etejedor Can you advise?

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).

Hello,

My python3 versions is 3.7.0.

Cheers,

Mark

and what is the output of root-config --python-version?

Hi,

root-config --python-version
2.7.16

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?

Cheers,

Mark

Hello,

Yes, the MacOS binary you are using is only compatible with Python2.

There are two options:

Or alternatively, if you already have a conda setup, you can install ROOT through conda: https://anaconda.org/conda-forge/root/files

These binaries are built with Python 3

Hello,

Ok thanks, will try building from source then.

Cheers,

Mark

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.

Cheers,

Mark

@oshadura could you have a look at the build errors Mark is having on MacOS?

Hello,

I had another go today. I created a fresh build directory and ran:

cmake -Druntime_cxxmodules=OFF -Dxrootd=OFF …/root >& cmake.log &
cmake --build . >& build.log &

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.

Cheers,

Mark

Doing:

cmake -Druntime_cxxmodules=OFF -Dxrootd=OFF -DPython3_ROOT_DIR=/Users/markhodgkinson/Library/Python/ -DPython3_EXECUTABLE=/usr/local/bin/python3 …/root

gives more promising output:

– 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…

Cheers,

Mark

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.

Thanks for advice. Yes it is working now :slight_smile:

Cheers,

Mark

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