I am on Mac OSX and I have a happily functioning ROOT/pyROOT installation from homebrew. I now want to try the ROOTBooks, and I have installed the dependencies as suggested here.
Everything starts up fine with root --notebook, but simply creating a new python notebook and trying to import ROOT shows that the module is not visible:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-ee8dc4376aa8> in <module>()
----> 1 import ROOT
ImportError: No module named ROOT
while “import ROOT” works correctly in a terminal in the same notebook session.
in one of the notebook cells, what does it print? Does you PYTHONPATH contain the lib folder in ROOT?
The second thing I would check is your PYTHONPATH right before calling root --notebook, does it contain the aforementioned folder?
One last thing I would like to mention is that you can create your ROOTbooks and easily share them with your colleagues without any local installation just by connecting to the SWAN service:
https://swan.cern.ch
You just need to have a CERNBox created (https://cernbox.cern.ch) before you first log in to SWAN.
If you spawn the Jupyter server from a terminal process, it should inherit the PYTHONPATH from that process.
Just to make sure ROOT is not interfering, can you spawn your Jupyter server with jupyter notebook instead of root --notebook? Do you observe the different PYTHONPATHs also in this case?
thanks, that did it! I am not sure why this would work while the root --notebook wouldn’t.
I’ve also taken a look at SWAN - nice idea for those with a CERN account, so it’s great for development.
I’m also trying to get this to work using the Jupyter Docker stacks as it would be very convenient for teaching. The discussion is here: https://github.com/jupyter/docker-stacks/issues/640. I’m not sure you want to close this one as I still see unexpected path in the ROOTBooks, but I don’t need them anymore
it may also have to do with the way mac/brew deal with their own environments. I had similar problems before. So if it’s only my case, don’t spend too much time on it
Regarding the Docker stacks, you are planning to prepare a Docker image with ROOT and Jupyter so that students can work with notebook during a course?
That’s the idea, in the first (ROOT-less) iteration of a graduate-level Jupyter course we used conda, but it already didn’t work too smoothly as some people had trouble depending on OS/setup/etc. Now that we’re adding a particle physics chunk we would really like to use ROOT, so I’m testing the waters in advance. Having a Docker image seems like the simplest solution, as students need to be able to work offline on their projects as well.