Building Root Python Mismatch

I am trying to build root 6.18 from sources using the cmake GUI.
I have two versions of python installed. The one which comes preinstalled on the mac (for me python 2.5.4) and I recently installed python 3.8.3. When I try to configure it gives me the error message:

  Version mismatch between Python interpreter (2.5.4) and libraries (3.8.3).

  ROOT cannot work with this configuration.  Please specify only
  PYTHON_EXECUTABLE to CMake with an absolute path to ensure matching
  versions are found.
Call Stack (most recent call first):
  CMakeLists.txt:159 (include)

I try to follow the recommendation, i.e to only specify PYTHON_EXECUTABLE. So I remove all paths for PYTHON_INCLUDE_DIR and PYTHON_LIBRARY (for PYTHON_LIBRARY_DEBUG it says PYTHON_LIBRARY_DEBUG-NOTFOUND). When I do that and try to configure again it gives me another error message:

CMake Error at /Applications/ (message):
Call Stack (most recent call first):
  /Applications/ (_FPHSA_FAILURE_MESSAGE)
  cmake/modules/SearchInstalledSoftware.cmake:9 (_find_package)
  cmake/modules/SearchInstalledSoftware.cmake:441 (find_package)
  CMakeLists.txt:159 (include)

Under Ungrouped Entries it says

What could be the problem?

Maybe @etejedor or @oshadura knows how to solve this kind of problem with several versions of Python on MacOS


My main goal is to be able to use pyroot.

So in the cmake gui there are three flags to set I guess: PYTHON_EXECUTABLE, PYTHON_INCLUDE_DIR and PYTHON_LIBRARY (there is also PYTHON_LIBRARY_DBUG but this is not found):

The preset paths in the gui are:


respectively. But this leads to the error message of mismatching as describe above.

So, to find my executable I did import sys and print(sys.executeable) in python which gave me:


When I pass that in for PYTHON_EXECUTABLE and leave the other flags untouched the installation seems to work (there are some warnings). BUT: when I try to import ROOT when in python, it says

ModuleNotFoundError: No module named 'ROOT'

which leaves me wondering if I have to change something for PYTHON_INCLUDE_DIR and PYTHON_LIBRARY.

Sorry I am kind of a newbie and everythin I do is rather trial and error than understanding what all of that means.


Normally, just specifying PYTHON_EXECUTABLE should be enough for CMake to configure with the right Python version. Can you double check that if you just specify the executable, once CMake has configured the other Python variables (e.g. PYTHON_INCLUDE_DIR) point to the Python3 installation too?

As for the No module named 'ROOT' error, that is another kind of issue: this happens because PYTHONPATH has not been configured to point to the ROOT installation, so it can’t find PyROOT. In order to configure your environment, you need to run source $ROOTSYS/bin/, where $ROOTSYS is the ROOT installation directory (or build directory, if you just built but not installed).

Hope this helps,

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