Unable to get jupyter server proxy working on theia

Hey all, total newbie here.
I’m trying to get jupyter notebook working on Theia. I have installed jsp using the command “pip install jupyter-server-proxy” and proceeded to follow the instructions on https://jupyter-server-proxy.readthedocs.io/en/latest/convenience/packages/theia.html

Can anyone let me know what I’m doing wrong here?

I’m not sure what the solution is, however I do have a (very very) old binder repo that install theia: https://github.com/betatim/theia-binder maybe that gives you some new ideas for what to do.

1 Like

Hi @nickhan123,

besides the configuration you linked to, you’ll also need to configure the server proxy in your ~/.jupyter/jupyter_notebook_config.py, e.g.

import os
c.ServerProxy.servers = {
  'theia': {
    'command': [
      '/path/to/bin/theia',
        'start', 
        os.environ.get("HOME"),
        '--hostname=127.0.0.1',
        '--port={port}'
    ],
    'timeout': 30,
    'launcher_entry': {
      'title': 'Theia'
    }
  }
}

Hope this helps.

3 Likes

It’s also possible to package that as a “pip” python package for the configuration. I thought that https://github.com/jupyterhub/jupyter-server-proxy/tree/master/contrib/theia had this included.

For example, in https://github.com/dirkcgrunwald/jupyter_codeserver_proxy- I set up a proxy for VScode. The installation then looks like the code below. The challenge is that you need to install the jupyterlab-server-proxy to get any of this to work and the version that’s in pip or conda is too old for jupyterlab-1.0 and above, if I recall.

RUN     (cd /tmp && \
        git clone https://github.com/jupyterhub/jupyter-server-proxy && \
        cd /tmp/jupyter-server-proxy/jupyterlab-server-proxy && \
        npm install && npm run build && jupyter labextension link . && \
        rm -rf /tmp/jupyter-server-proxy )

RUN     $CONDA_DIR/bin/pip  install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple jupyter-codeserver-proxy==1.0b3

RUN     cd /opt && \
        mkdir /opt/code-server && \
        cd /opt/code-server && \
        wget -qO- https://github.com/cdr/code-server/releases/download/2.1698/code-server2.1698-vsc1.41.1-linux-x86_64.tar.gz | tar zxvf - --strip-components=1
ENV     PATH=/opt/code-server:$PATH

The resulting proxy display looks like the following on our setup. I could never get the VScode tile to get to where e.g the Terminal is (which would make more sense) but I didn’t invest much time in trying.
vscode

1 Like

Hi All, Curious if you got this working @nickhan123 or @manniche? I’m also a relative newbie to extensions and jupyter proxy servers and haven’t been able to get it to work. I think the idea of modern editors inside of jupyterlab could be really transformative, but I’m having a hard time putting things all together. A concrete end to end example of theia or code server would really help as I can install theia or code-server, how to point juptyerlab to them seems to not be happing with ‘pip install jupyter-server-proxy’ and debugging is challenging. dirkcgrunwald example is useful but I can’t install docker in current environment and don’t have his image.

Not able to post a complete working example here, unfortunately. Even though this is arguably easier to do in a docker container, you should basically follow the commands in the Dockerfile definition given above. Additionally, you need to place the configuration file I listed above in the path I also specified.
You can try starting jupyterlab from the command line and watch the log output to see if there are any errors or warnings. You are welcome to paste any log output you get in here.

Just to say - I would also be very interested to get such a setup working. Has anyone got a recent version of Theia to work (as opposed to VSCode)?

https://github.com/betatim/theia-binder does this help?