Opened 7 years ago

Closed 7 years ago

#54694 closed defect (fixed)

ROOT6 pyroot in jupyter notebooks

Reported by: hansgans Owned by: cjones051073 (Chris Jones)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: mojca (Mojca Miklavec)
Port: root6

Description

Problem:

When using pyroot in Jupyter notebooks with import ROOT. The modules JupyROOT and JsMVA are expected to be found in the python path. After the installation of the root package those modules are located in libexec/root6/lib/root/ and therefore not found by python. JupyROOT and JsMVA are only needed for Jupyter, not for python/ipython.

Solution:

I suggest to copy those modules together with libJupyROOT.so to the python site-packages directory.

Change History (16)

comment:1 Changed 7 years ago by mf2k (Frank Schima)

Cc: mojca added
Keywords: pyroot jupyter removed
Owner: set to cjones051073
Status: newassigned

In the future, please Cc the port maintainers (port info --maintainers root6), if any.

comment:2 Changed 7 years ago by cjones051073 (Chris Jones)

Sounds like a good idea. I will take a look.

It would help if you could post some basic instructions I could use to test any changes. I am not familiar with using Jupyter ?

comment:3 Changed 7 years ago by hansgans

Some instructions:

    port install root6 +python35 py35-jupyter
    jupyter notebook ./      #should open a browser and redirect you to localhost:8888
    #Start a new python notebook and load ROOT
    import ROOT

comment:4 Changed 7 years ago by hansgans

And as I mentioned in #54695, I suggest to add the jupyter (and other python dependencies) to the root variant +pythonXY.

comment:5 Changed 7 years ago by cjones051073 (Chris Jones)

Thanks. Update pushed adding jupiter support.

comment:6 Changed 7 years ago by hansgans

Perfect works like a charm! Thanks a lot!

comment:7 Changed 7 years ago by JoachimRose

My first post on macports.org. Followed the instructions above. Starting with a fresh Macports installation

sudo port install root6 +python35 py35-jupyter

This worked fine, but then after a new login

jupyter notebook ./ 
  -bash: jupyter: command not found
root --notebook
  Error starting ROOT notebook -- please check that Jupyter is installed

So both methods of getting a notebook failed. Then added aliases to the ~/.bash_profile

 alias jupyter='/opt/local/bin/jupyter-3.5'
 alias jupyter-notebook='/opt/local/bin/jupyter-notebook-3.5'

After a new login the first method then works

jupyter notebook ./ 
import ROOT
  Welcome to JupyROOT 6.10/04

The second method, root --notebook, still fails. What is needed to also get the second method, which is more natural for a root6 user, to work?

Last edited 7 years ago by JoachimRose (previous) (diff)

comment:8 Changed 7 years ago by hansgans

I suggest that you open a new bug report. Nevertheless, I tried it and encountered the same problem. Creating a symbolic link solves it:

ln -s /opt/local/bin/jupyter-3.5 /opt/local/bin/jupyter

So root6 is compiled with python35 is obviously looking for a jupyter binary which is not found.

comment:9 Changed 7 years ago by cjones051073 (Chris Jones)

You should not be creating symbolic links in the macports prefix yourself. I suggest you remove this.

Because macports has the ability to install jupyter for multiple python versions at the same time, the python version is encoded into the command name. For instance I have

jupyter-2.7 jupyter-3.5

Corresponding to those two python versions.

You will have similar commands installed depending on what python version you are using. So just use these.

comment:10 Changed 7 years ago by cjones051073 (Chris Jones)

Note you should file a feature request report against jupyter asking the maintainer to add a 'port select' feature for these sets of ports. In that way you will be able to select yourself which version is provided by the versionless 'jupyter' command.

comment:11 Changed 7 years ago by hansgans

@cjones051073 If root is compiled with e.g python-3.5 then it expects that jupyter points to jupyter-3.5. How can you ensure this if the user can set jupyter to arbitrary versions? Is it possible to compile root with an option for a specific jupyter executable?

comment:12 Changed 7 years ago by cjones051073 (Chris Jones)

What *should* happen is the ROOT configure settings should provide the option to set the juypter command to use, instead of just assuming it will be 'jupyter'. If this is the case it can be set when root is built to point to the appropriate command to run. I need to take a look to see if this is possible or not.

comment:13 Changed 7 years ago by hansgans

Thanks!

comment:14 Changed 7 years ago by cjones051073 (Chris Jones)

It turns out ROOT does not provide an option to change the command easily it uses for juypter, its hardcoded. I have though just pushed an update that patches this to change it to the correct one for MacPorts, based on the active python version. can you give it a try, it works OK for me.

Could you also please follow up with upstream to ask them to provide more configurable options to control things like this.

comment:15 Changed 7 years ago by hansgans

Works!

comment:16 Changed 7 years ago by Schamschula (Marius Schamschula)

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.