Issue with root --notebook

I am setting up a brand new Mac M2. OS is Sonoma (14.2)

I installed homebrew.
Next, I installed root with “brew install root”.
Vanilla root works.

This also installs Python 3.11 etc. as a dependency.

Next, I install jupyter with pip3.

Neither jupyter-notebok nor jupyter-lab worked.
For jupyter-lab the problem is the same as this StackOverflow post

Following the hints in that post, I solved it by setting
c.LabApp.app_dir = ‘/opt/homebrew/share/jupyter/lab’
in the jupyter config file
/opt/homebrew/etc/notebook/jupyter_lab_config.py

For good measure, I also did
export JUPYTER_PATH=/opt/homebrew/share/jupyter
export JUPYTER_CONFIG_PATH=/opt/homebrew/etc/jupyter
but I am not sure that it was necessary.

Now both jupyter-notebook and jupyter-lab work.

However, when I do
root --notebook
I get a lot of errors (1) and the opened webpage is blank (only has the jupyter logo). I think I was getting the same identical behavior when trying jupyter-notebook as opposed to jupyter-lab before the fixes above.
So it smells like the config file is not picked up in this case (?).

Also: the ROOT kernel does not show up in Jupyter-lab.

Any ideas?

Thanks

Claudio

(1) The full output is here

PS: These are the jupyter versions that are installed

$ pip3 list | grep jupyter
jupyter 1.0.0
jupyter_client 8.6.0
jupyter-console 6.6.3
jupyter_core 5.5.1
jupyter-events 0.9.0
jupyter-lsp 2.2.1
jupyter_server 2.12.1
jupyter_server_terminals 0.5.0
jupyterlab 4.0.9
jupyterlab_pygments 0.3.0
jupyterlab_server 2.25.2
jupyterlab-widgets 3.0.9

_ROOT Version: 6.30/02
_Platform: macosxarm54
_Compiler: Apple clang version 15.0.0


Hi @claudio_campagnari,

thank you for your question. Unfortunately I cannot reproduce your issue directly, but maybe @vpadulan has an idea how to fix your issue?

Cheers,
Marta

Dear @claudio_campagnari ,

Thanks for reaching out to the forum! Let me try to bring some clarity to the situation:

  • I don’t think root --notebook has any notion of JupyterLab per se, it only opens a Jupyter notebook instance. If import ROOT works in the normal Jupyter notebook (i.e. via jupyter-notebook) I am not sure that this can translate 1:1 to JupyterLab
  • Ideally, one would use ROOT inside the environment where either Jupyter or JupyterLab are. From your description above, it looks like you are creating two different environments. The one with homebrew and the one with pip. This is usually recipe for confusion and unexpected bugs, so I would avoid it in general (i.e. irrespective of ROOT).
  • It is crucial that the Python executable that you use to import ROOT in any circumstance, i.e. at a Python prompt, executing python myscript.py, opening a Jupyter notebook or a JupyterLab instance etc. is the very same Python executable used to create the ROOT installation. In your situation above, whatever Python was used to create the homebrew package (and again here comes the problem that you are then installing Jupyter separately).

I hope this explains a bit the situation.

Cheers,
Vincenzo

Hi Vincenzo

thank you for your help.

I am pretty sure it is not an issue with different environment – pip and python and root are installed by brew, everything is “together”.

It is also not an issue with jupyter-lab vs. jupyter-notebook. Essentially jupyter-lab is a wrapper around the notebook (and much more).

Checking out the error messages and doing some further googling I solved the problem at the 90% level.

Here is what I did, for posterity and since it may help someone else eventually.


There were several errors about not found jsons in this directories:
/opt/homebrew/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/share/jupyter/lab/schemas/@jupyterlab/XXX-extension
where XXX=applications, apputils, notebook, shortcut, … etc etc

I found that in the installation straight out of brew
/opt/homebrew/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/share/
only has a doc subdirectory

Then I did the following

brew install Node.js
brew install npm
jupyter lab build
pip3 install metakernel

Now
root --notebook
works!
(Opens a vanilla notebook, no through the lab).

Most jsons are now found, but not all.
The missing jsons are:
blah_blah_blah/@jupyter-notebook/application-extension/shell.json
blah_blah_blah/@jupyter-notebook/notebook-extension/scroll-output.json
blah_blah_blah/@jupyter-notebook/tree-extension/widget.json
These errors do not seem to be fatal, so for now I ignore them.

I said that it works at the 90% level because when I do
jupyter-notebook
or
jupyter-lab
The ROOT kernel is not available. It is only available with
root --notebook

Not a big deal…
At some point I may try to figure out how to “register” the ROOT kernel with jupyter…do you have suggestions?

Thanks again

Claudio

This is the thing, I never use root --notebook myself. I always open a Jupyter notebook and I can import ROOT normally as any other Python package. So I am not sure why in your case this doesn’t work. To be further debugged.

Cheers,
Vincenzo

Hi Vincenzo,

You may have misunderstood me…

I can do
import ROOT
in a jupyter python kernel (lab or notebook), and it works.

What I am not able to do is to select the ROOT C++ kernel when starting jupyter (lab or notebook). I can only select it when the notebook is started via
rooot --notebook

In contrast, on my old mac that I had setup some time ago the ROOT C++ kernel is available when starting jupyter (lab or notebook) as well as with “root --notebook”.
See screenshot linked below (from my old intel mac…notebook started with “jupyter-notebook” command.)

To be fair, I seem to remember that setting this up on the old mac was not entirely smooth…but I do not remember what I did. :frowning:

Happy holidays!

Claudio

Dear @claudio_campagnari ,

Thank you for the further clarification, now I see what the problem is. We need to investigate what happened that made the C++ kernel disappear, if it’s a problem only for the most recent Mac or if it is also a problem in newer ROOT versions irrespective of the platform.
Have a nice holiday break!
Cheers,
Vincenzo

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