jupyter-rsession-proxy
jupyter-rsession-proxy copied to clipboard
can manually connect but not with the UI
I'm working my way through getting nbrsessionproxy installed installed on my JupyterHub stack that uses DockerSpawner and JupyterLab. I've inched forward and can now manually run R Studio Server from the command prompt like this:
/usr/lib/rstudio-server/bin/rserver --www-port=56789
and then I can connect to that R Studio Server by manually putting the link in my browser:http://localhost:8000/user/jal/proxy/56789/ (my uid is jal)
Note that from Jupyter Terminal I cannot type simply enter rserver as it needs the full path. Is this a clue?
I have struggled to get the PATH set in such a way that I was confident /usr/lib/rstudio-server/bin/ was guaranteed to be in the path. So for the sake of testing, I edited handlers.py to include the full path in the rserver command:
def get_cmd(self):
# rsession command. Augmented with user-identity and www-port.
return [
'/usr/lib/rstudio-server/bin/rserver',
'--www-port=' + str(self.port)
]
This did not change the behavior when I click on RStudio -> Launch R Studio in the JupyterLab UI. That still opens http://localhost:8000/user/jal/rstudio with the following 404 message:

Any tips on what I might test next? I'm a bit hung as I can't figure out how to debug what's happening when I click the menu buttons. Is there a log file I should be checking? The code makes it seem like there's also a temp file that contains the port, etc. Is there an easy way of finding that temp file?
Many thanks,
J
Ok, problem partially solved. I misinterpreted the install instructions. Since I am running JupyterLab I skipped this bit:
jupyter serverextension enable --py --sys-prefix nbrsessionproxy
jupyter nbextension install --py --sys-prefix nbrsessionproxy
jupyter nbextension enable --py --sys-prefix nbrsessionproxy
And I jumped right to the JupyterLab part:
git clone https://github.com/jupyterhub/nbrsessionproxy /opt/nbrsessionproxy
pip install -e /opt/nbrsessionproxy
jupyter serverextension enable --py nbrsessionproxy
jupyter labextension link /opt/nbrsessionproxy/jupyterlab-rsessionproxy
I now realize that I need to do the first part AND the second part. What threw me off was this line:
For JupyterLab first clone this repository to a known location and install from the directory.
That's not the first thing you do if installing with JupyterLab. That's the forth or fifth thing you do. You might want to make that read something like:
For JupyterLab, after completing the steps above, clone this repository to a known location and install from the directory.
However I am still unable to get the path set properly such that R Studio will run without my handlers.py hack mentioned above. Any tips would be appreciated. I am reading through the DockerSpawner documentation hoping to find clues. The documentation makes me think that I should edit my jupyterhub_config.py to include the following:
c.Spawner.env_keep.append('PATH')
c.Spawner.env_keep.append('LD_LIBRARY_PATH')
However I have that in place but now R Studio gives me a 500: Internal Server Error:

Any tips on where to look for diagnostic logs that might give me some clues?
FYI Folks at SDSC helped me get this up and running locally. I don't (yet) have the details on how they got it hooked up to the jupyterhub stack however, but it does work ... at least until the latest commit to nbrsessionproxy today which seems to have broken some stuff.
https://github.com/radiant-rstats/docker/tree/master/rsm-jupyterhub
I use the following launch script to run locally.
https://github.com/radiant-rstats/docker/blob/master/launch-rsm-jupyterhub.sh
@vnijs This extension and nbserverproxy have been significantly updated by @yuvipanda recently. Please use the latest released versions for now rather than master.