Home | News | Documentation | Download

pyRoot on pyCharm

Hello everybody!

I’d like to use pyRoot with pyCharm but I have some problems.
pyRoot works perfectly when I use it on “standard” linux terminal, but on pyCharm I get the following mistake:

Traceback (most recent call last):
  File "/home/alessandro/Scrivania/python/prova/venv/prova.py", line 1, in <module>
    from ROOT import gROOT, TCanvas, TF1
ModuleNotFoundError: No module named 'ROOT'

Can someone help me, please?


ROOT Version: 6.18/04
Platform: Ubuntu 18


I guess @etejedor can help you.

Hi,

The ROOT Python module is not being found. I would make sure that PYTHONPATH is properly set in PyCharm.
When using ROOT from the terminal, you must have set your environment somehow (i.e. with source bin/thisroot.sh, you need to set it for the PyCharm process as well.

Hi,

Sorry but I’m not very smart on this topic. When you say PYTHONPATH, do you mean to modify the “Interpreter paths”? The one you find in File -> Settings -> Project interpreter -> Show all -> Show paths for the selected interpreter -> Interpreter paths. And in such case, what should I add? I have made different efforts but in vain.

Hi,

I think so, yes, according to:

PYTHONPATH is a Python environment variable that points to the places where Python looks for libraries. I guess PyCharm configures it for you when you set the “interpreter paths”.

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