No root canvas window on Ubuntu


I’ve been using ROOT on Windows for historical reasons and now I’d really like to move to linux and ROOT 6 but I have an issue.

On windows I use pyroot in jupyter notebooks (Windows 10, ROOT 5.34/36, Anaconda python 2.7.14, jupyter 4.3.0). My workflow includes plotting various distributions, fitting them etc. The simplest example I can think of is

from ROOT import TH1D, TCanvas
c = TCanvas('c', 'c', 1800, 0, 700, 700)
h = TH1D("gauss", "Example histogram", 100, -4., 4.)

On windows this opens an interactive ROOT window with the histogram - I can right click on it, open a fit panel and fit it with a gaussian - no problem.

On linux (Ubuntu 18, ROOT 6.14/04, Anaconda python 3.6.5, jupyter 4.4.0) if I run the same code I don’t get any root window, the canvas and histogram are created but not drawn in a window or inline in the notebook. The closest I can get to the same behaviour on linux is the following code

from ROOT import TH1D, TCanvas, gROOT
c = TCanvas('c', 'c', 10, 10, 700, 700)
h = TH1D("gauss", "Example histogram", 100, -4., 4.)

Now a ROOT window is opened and the histogram is drawn but the histogram is also drawn as a png inline below the cell in the notebook. Also the ROOT window is not interactive - it has File Edit View Options Tools at the top but clicking on them does nothing. The histogram seems to be an image - clicking on it does nothing and it does not resize with the window.

Please help - I can’t think of anything else to try.


ps: I can run all of the scripts in root/tutorials/pyroot on both windows and linux and root windows are correctly opened and populated. So I think it must be down to different behaviour of jupyter !? Is there something simple I am missing ?

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

Hi Emmett,

If you are working with ROOT and Jupyter and you want the canvas to be display, you need to invoke:


This will make the contents of the canvas to be flushed to the output of the cell.

If you want your ROOT graphics in the notebook to be interactive and not a static png image, you can run in a cell:

%jsroot on

This is an example notebook you can check:


That is fine but it is not what I am trying to do. I don’t want the graphs inline - a notebook full of plots quickly becomes very difficult to navigate. JSROOT is fine but there is no fit panel to quickly fit a histogram or graph.

Is there any way to get the same functionality as on Windows where a proper interactive ROOT window is opened ? I am cycling through a lot of cells making different plots and the way I currently work the histograms/graphs appear one after the other on the same canvas in the ROOT window.




I think the correct behavior is the Linux one. AFAIK, there should not be any Window opened when using notebook…

Cheers, Bertrand.

Hi Emmett,

The JavaScript fit panel is in the making but not ready yet, so unfortunately you still cannot use it from a notebook. I invited @bellenot and @couet in case they want to comment on that.

In order to use the classic graphics, is it ok for you to use a normal Python/IPython prompt for now until the JavaScript fit panel is ready?


I’m not sure I understand why this can work on windows but not on linux. Is there a technical reason why it is not possible ?
I read through the conference talks and I understand that you are intending to move to a web/jsroot based display/gui which is really cool, but in the mean time for fast turn around in analysis it’s really useful to have the convenience of the notebook with the power of the full ROOT gui.

Is there a way on linux to have the jsroot output in a separate window to the notebook ? If every plot appears below the cell the notebook becomes very cluttered very quickly.


Well, between ROOT 5.34.36 (Windows) and ROOT 6.14/04 (Linux), some development has been made :wink: But @etejedor knows what should be the correct behavior. Then I’ll make sure the behavior of ROOT 6 on Windows follows the one on Linux.

Oh No ! Don’t make the behaviour the same on windows - that will break everything I do ! :slight_smile:

Seriously - is there a technical reason why a full root window can’t be instantiated from a notebook on linux (but it can be on windows) ?

From ipython on linux you can do

from ROOT import TCanvas
c = TCanvas('c', 'c')

and a full ROOT window appears. If it works from ipython shouldn’t it be trivial to make it work from a notebook (like on windows) ?


I don’t see why it couldn’t work… @etejedor?

I believe the right way to go, in the context of the notebooks, is to have all the graphics managed by the browser and implemented with some web technology (i.e. JavaScript).

I do not have an explanation why you can open and interact a window with the classic graphics from a notebook on Windows and not on Linux, but I would recommend that if you want to work with the classic fit panel you use the python or IPython prompt. Soon, we will have all these graphics in JS as well and we will support them from the notebook.


It’s not just the fit panel but other things you can do from the gui too - like the editor, status bar, object inspector, browser etc.

I understand how you want to move to the web interface and it totally makes sense but there doesn’t seem to be any fixed time frame for all that work to be completed.

IPython is just not a replacement for me for a workflow in notebooks.

I just feel like there’s something trivial that’s stopping a gui canvas window being opened from within a notebook - especially as it works on windows and from ipython on linux.

Does anyone else there have an idea what it could be ? I’m happy to take a look at doing it if someone could point me in the right direction. I’m pretty desperate to move onto ROOT6/linux.


ps: @bellenot - congratulations on getting ROOT6 compiling on windows ! I tried it but it seemed a bit buggy - happy to give some feedback if you are interested.

Did you try to simply call gROOT->SetBatch(kFALSE); in a cell?

Thanks! And yes, if you have some feedback, you can send it directly to me (I’m already aware of several issues and in the process of fixing them…)

Yes - if you look in my original post at the second short piece of code I do exactly that.

Then you get an inline png of the histogram in the notebook and a window opens which also displays the histogram. The window looks like a ROOT window and has File Edit View Options Tools at the top but nothing happens when you click on them . Also the window is not interactive - nothing happens when you click or right click on the histogram and the histogram does not resize when you resize the window.

Any ideas ?

Oh, yes, sorry, I overlooked at your post… And no, no other idea, sorry.

Do you think the GUI event loop is stuck ?

Well, it’s hard to tell, I’ll have to dig in the code and maybe even debug it. The Windows and Linux underlying systems are completely different…

Seems like it is almost there - the GUI window and histogram are drawn correctly.

I just tried again and if I re-fill the histogram and re-draw it and update the canvas then the histogram in the window updates - it’s just that the gui window is not interactive.

ps: will send you ROOT6 windows feedback directly

so there is probably a gSystem->ProcessEvents() missing somewhere…

Sounds like that could be it