ModuleNotFoundError: No module named 'ROOT'

_ROOT Version: 6.28/04
_Platform: macosxarm64
Compiler: Not Provided

My ROOT is install in macOS(version: 13.5) using anaconda. When I try to import ROOT in jupyter Notebook or in python3, I’m getting this error:

import ROOT
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘ROOT’.
my current python version is 3.11.4

May be @vpadulan has an idea.

Hi @arkodipb ,

Thanks for reaching out. I’m guessing that you are not using the right Python environment. Since you installed with conda, make sure you are activating the conda environment where you installed ROOT and you always use that (as also described in the installation instructions)

conda create --name myenv -c conda-forge root 
conda activate myenv
python -c "import ROOT"

Hi @vpadulan,

I was using the exact environment in which I have installed ROOT. When I try to use particularly python3, I can’t import ROOT. But only with python its working. But in Jupyter notebook import ROOT isn’t working. This screenshot might help to clarify my issue.

Indeed, as I suspected, you are not using the same Python of the conda environment you used to install ROOT. You can already notice it at the line

$: python3
Python 3.11.4 .... [Clang 14..0.3 .... on darwin


$: python
Python 3.11.4 | packaged by conda-forge

Only the second python is the conda one, the other one comes from your system. You can confirm this by typing which python/which python3 and seeing the paths of the two different executables.

The same problem will be true for the jupyter notebook. One way to make sure you are running the notebook from the conda environment is to pass through ROOT itself with root --notebook.

Thanks a lot, resolved.

1 Like

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