jupyter-rsession-proxy
jupyter-rsession-proxy copied to clipboard
Terminal not working in RStudio
Hello! When I run jupyter-rsession-proxy
with this Dockerfile and try opening a terminal in RStudio, I get the following error in console:
[I 09:15:51.316 NotebookApp] Trying to establish websocket connection to ws://localhost:46203/p/a345fca3/terminal/C3090FD3/
[E 09:15:51.471 NotebookApp] Exception in callback functools.partial(<bound method IOLoop._discard_future_result of <tornado.platform.asyncio.AsyncIOMainLoop object at 0x7f35952d9b38>>, <Task finished coro=<ProxyHandler.proxy_open.<locals>.start_websocket_connection() done, defined at /opt/conda/lib/python3.7/site-packages/jupyter_server_proxy/handlers.py:258> exception=HTTP 404: Not Found>)
Traceback (most recent call last):
File "/opt/conda/lib/python3.7/site-packages/tornado/ioloop.py", line 743, in _run_callback
ret = callback()
File "/opt/conda/lib/python3.7/site-packages/tornado/ioloop.py", line 767, in _discard_future_result
future.result()
File "/opt/conda/lib/python3.7/site-packages/jupyter_server_proxy/handlers.py", line 263, in start_websocket_connection
on_message_callback=message_cb, on_ping_callback=ping_cb)
tornado.httpclient.HTTPClientError: HTTP 404: Not Found
and the terminal displays nothing
Me too -
[I 20:02:26.977 NotebookApp] Trying to establish websocket connection to ws://localhost:54789/p/af1d970b/terminal/418A9C1A/
[E 20:02:26.980 NotebookApp] Exception in callback functools.partial(<bound method IOLoop._discard_future_result of <tornado.platform.asyncio.AsyncIOMainLoop object at 0x7fd7ceb825c0>>, <Task finished coro=<ProxyHandler.proxy_open.<locals>.start_websocket_connection() done, defined at /usr/local/lib/python3.6/dist-packages/jupyter_server_proxy/handlers.py:258> exception=HTTP 404: Not Found>)
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tornado/ioloop.py", line 743, in _run_callback
ret = callback()
File "/usr/local/lib/python3.6/dist-packages/tornado/ioloop.py", line 767, in _discard_future_result
future.result()
File "/usr/local/lib/python3.6/dist-packages/jupyter_server_proxy/handlers.py", line 263, in start_websocket_connection
on_message_callback=message_cb, on_ping_callback=ping_cb)
tornado.httpclient.HTTPClientError: HTTP 404: Not Found
[E 20:02:49.098 NotebookApp] Uncaught exception POST /rstudio/events/get_events (192.168.2.1)
HTTPServerRequest(protocol='http', host='127.0.0.1:8888', method='POST', uri='/rstudio/events/get_events', version='HTTP/1.1', remote_ip='192.168.2.1')
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tornado/web.py", line 1699, in _execute
result = await result
File "/usr/local/lib/python3.6/dist-packages/jupyter_server_proxy/handlers.py", line 434, in proxy
return await super().proxy(self.port, path)
File "/usr/local/lib/python3.6/dist-packages/jupyter_server_proxy/handlers.py", line 199, in proxy
response = await client.fetch(req, raise_error=False)
tornado.simple_httpclient.HTTPTimeoutError: Timeout during request
Salient parts of my Dockerfile -
RUN python3 -m pip install --upgrade pip && \
python3 -m pip install jupyter jupyterhub jupyterlab
...
...
&& python3 -m pip install git+https://github.com/jupyterhub/jupyter-server-proxy \
&& python3 -m pip install git+https://github.com/jupyterhub/jupyter-rsession-proxy
A workaround I have found is to turn off websockets under Tools -> Global Options -> Terminal. This fixes it. Not sure how to set this programmatically so I can bake it into an image...
Another workaround is to use the pypi version of jupyter-rsession-proxy
rather than the github version. This is version 1.0.b6
and terminal works with websockets.
I figure out another workaround. I manually change the global options in my session, export the user-settings file from /home/jovyan/.rstudio/monitored/user-settings/, then use kuberspawner lifecycle_hooks to copy this user-settings to the home directory of every user who try to spawn a rstudio container.
lifecycle_hooks = {"postStart": { "exec": { "command": ["/bin/sh", "/etc/rstudio/config-rstudio.sh"] } }}
config-rstudio.sh can be like
mkdir /home/jovyan/.rstudio/monitored/user-settings -p && cp /etc/rstudio/user-settings/user-settings /home/jovyan/.rstudio/monitored/user-settings/
@anton-khodak Hi, did you found a solution for this ? I am facing the same problem.
@FernandezMathieu
With @anton-khodak we got it working using rstudio-server-1.2.5019-amd64.deb
with the latest jupyter-server-proxy
and juvipanda's jupyter-rsession-proxy.
Relevant parts of our Dockerfile
# jupyter-server-proxy extension
RUN pip install jupyter-server-proxy
# use yuvipanda version of jupyter-rsession-proxy (nbrsessionproxy)
RUN pip install https://github.com/yuvipanda/nbrsessionproxy/archive/rserver-again.zip
RUN jupyter serverextension enable --sys-prefix jupyter_server_proxy
@FernandezMathieu With @anton-khodak we got it working using
rstudio-server-1.2.5019-amd64.deb
with the latestjupyter-server-proxy
and juvipanda's jupyter-rsession-proxy.Relevant parts of our Dockerfile
# jupyter-server-proxy extension RUN pip install jupyter-server-proxy # use yuvipanda version of jupyter-rsession-proxy (nbrsessionproxy) RUN pip install https://github.com/yuvipanda/nbrsessionproxy/archive/rserver-again.zip RUN jupyter serverextension enable --sys-prefix jupyter_server_proxy
Well, i try with your configuration but it still don't work. Anyway i think the problem come from my distribution (centOS). Thanks for the reply !
If you share your Dockerfile perhaps we can find the main differences and go from there. You can find our whole Dockerfile here (there be dragons in there).
@BigDataRsk
Well, i try with your configuration but it still don't work. Anyway i think the problem come from my distribution (centOS). Thanks for the reply !
I'm facing same experience. Works fine on ubuntu host server, while having tornado.simple_httpclient.HTTPTimeoutError: Timeout during request
on centOS host server