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/CMake.app/Contents/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
Call Stack (most recent call first):
/Applications/CMake.app/Contents/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE)
/Applications/CMake.app/Contents/share/cmake-3.17/Modules/FindPythonLibs.cmake:310 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
cmake/modules/SearchInstalledSoftware.cmake:9 (_find_package)
cmake/modules/SearchInstalledSoftware.cmake:441 (find_package)
CMakeLists.txt:159 (include)
Under Ungrouped Entries it says
PYTHON_LIBRARY_RELEASE
PYTHON_LIBRARY_RELEASE-NOT FOUND
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):
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/thisroot.sh, where $ROOTSYS is the ROOT installation directory (or build directory, if you just built but not installed).