Problems running pyROOT

Hi,

I really have a probably trivial question, but I would like to try pyRoot for the first time. Now, following the description under Python interface: PyROOT - ROOT it should be as easy as:

  1. Install ROOT 6.22/06 (I downloaded https://root.cern/download/root_v6.22.06.Linux-ubuntu18-x86_64-gcc7.5.tar.gz for Linux Mint 19.3, unpacked it and can run ROOT from prompt)
  2. Have python installed (my version is 3.6.9)
  3. In python prompt type ‘import ROOT’

The result of these steps is

Python 3.6.9 (default, Oct  8 2020, 12:12:24) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
Traceback (most recent call last):
  File "/home/klausg/Software/root/lib/cppyy/__init__.py", line 60, in <module>
    importlib.import_module(libcppyy_mod_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'libcppyy3_6'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/klausg/Software/root/lib/ROOT/__init__.py", line 22, in <module>
    import cppyy
  File "/home/klausg/Software/root/lib/cppyy/__init__.py", line 64, in <module>
    libcppyy_mod_name, major, minor))
ImportError: Failed to import libcppyy3_6. Please check that ROOT has been built for Python 3.6 

I also tried installing cppyy with

pip3 install cppyy

but this failed as well.

Now, what do I need to do to run pyroot? A bit more of documentation about the setup procedure on the web-page would be very helpful. I admit that my experience with python (and all the modules and extensions) itself is also rather limited.

Best regards and thanks,
Klaus


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


Could you go a little bit more in detail? I did

> root-config --python3-version
> . /home/klausg/Software/root/bin/thisroot.sh 

and get exactly the same error on ‘import ROOT’ as before. Or is it about compiling/bulding ROOT myself?

Ok, I think I got it. Running with python2 works.

These commands do NOT switch the python version.
They just tell you if your ROOT distribution supports it (and if yes, which version exactly),

Is there a pre-compiled ROOT version against python3 available for download? In the list here

I don’t see this information.

Hi,
I believe for the pre-compiled binaries we use whatever python resolves to by default on the given Linux flavour and version. On Mint, I think that’s still python 2. Does root-config --python3-version display anything?

The conda and snap packages however support Python 3, see https://root.cern/install for instructions/pointers to install ROOT via those package managers.

Cheers,
Enrico

Hi Enrico,

root-config --python3-version prints out an empty line. Thanks for the hint about snap, I’ll take a look at this one.

Best,
Klaus

Yeah that means that ROOT build was not configured for Python3.

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