ImportError: No module named ROOT - installed from linux distribution repo


I had to format my laptop and now get this error when I try to run a python script that used to work before I reinstalled everything.

Traceback (most recent call last):
  File "/home/jimmy/.MC-TOOLS//bin/mctal2root", line 11, in <module>
    import ROOT
ModuleNotFoundError: No module named 'ROOT'

I’ve found several threads like this here, but they all say I have to run script, which I don’t have since I installed ROOT on my Fedora 33 (linux distro) from system repositories.

Can you help me with this, please?

Thank you.

Hi @Ziel_van_brand,
is ROOT installed correctly? E.g. can you start the ROOT prompt with the root command?

Do you have different Python versions installed on your system? Could it be that the ROOT you installed is meant e.g. for Python 3 and you started a Python 2 interpreter?

As you say, it should be enough to install the ROOT Fedora package via dnf or similar to have it up and running, that’s how we build our Fedora Docker images for example.
That’s a test you could do, in fact: start a Fedora Docker container and install ROOT in it, and see if it works there. If yes, there is something broken in your environment.



Yes, root itself works fine. I can launch it from the terminal and it correctly executes macros.

Do you have different Python versions installed on your system?

I don’t know how to check that.

Fedora Docker

This is the first time I read about this…

e.g. which python, python<TAB><TAB>, dnf list installed "python*" or similar.

In case it helps, here is the recipe we use to create ROOT’s Fedora Docker images. I see that among the packages we install there is a python3-root, maybe that’s what you are missing?

1 Like

Ok, maybe this can help:

$ python --version
Python 3.9.1

Oh yeah!

That missing package caused the issue!

Thank you! Now everything works fine.

1 Like

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