Setting up pyroot from source

Hi, I don’t seem to be about to import root class in my python program so I’m trying to set up Pyroot one more time.

I’m currently using Python from Anaconda distribution and I’m wondering whether that is ok for setting up pyroot, I’m concerned since the user’s guide says “If you download the ROOT binaries, take care to download and install the Python distribution from http://www.python.org/ against which they were built”

Do I need to reinstall Python from the python website or is Anaconda distribution ok ?

In principle it shouldn’t be a problem building ROOT with Python from anaconda. There was recently a user that encountered some problems with additional libraries from anaconda, which are fixed in the master branch. See https://root-forum.cern.ch/t/24099

So I already have root installed and it’s working correctly, but I found that the pyroot is not set up correctly since I can’t import ROOT class from python session, how do I fix that. I checked the user’s manual and I tried

./configure [–with-python-incdir=][–with-python-libdir=>dir>]

from my root directory
but I got an error saying " arch: No such file or directory", I don’t understand.
Thank you.

What version of ROOT? You should use CMake to build ROOT. See https://root.cern.ch/building-root
If you Python is not found, you can force it by specifying the variable PYTHON_EXECUTABLE

-DPYTHON_EXECUTABLE=/opt/anaconda/.../bin/python

I’m using 5.34.34

I believe I already have ROOT working correctly and I did use CMake before
Do I have to build ROOT all over again in order to set up pyroot ?

Hi, when specifying the PYTHON_EXECUTABLE, should I do

/usr/local/bin/python
or
/usr/local/bin/python3.5

Not sure whether I should specify the version ?

Is it enough to specify just one variable, since I saw two more (PYTHON_INCLUDE_DIR
and PYTHON_LIBRARY)? Do I need to include these two as well ?

Here is my command but it doesn’t work:
cmake /Users/homefolder/Desktop/root -DPYTHON_EXECUTABLE=/usr/local/bin/python3.5 -DPYTHON_INCLUDE_DIR = /Library/Frameworks/Python.framework/Versions/3.5/Headers/Python.h -DPYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5.dylib

DPYTHON_INCLUDE_DIR with no spaces before and after = and it sould be the directory and not the include file itself.
-DPYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/3.5/Headers

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