itkwidgets icon indicating copy to clipboard operation
itkwidgets copied to clipboard

the lab alpha version breaks something about jupyter server proxy

Open satra opened this issue 2 years ago • 11 comments

the following works and if running the built container will allow running the linux desktop. however, replacing the itkwidgets install with the latest alpha breaks something in the server proxy layer. it's likely this has something to do with imjoy which also does not launch.

FROM jupyter/datascience-notebook:2023-01-16

USER root
# Install jupyter server proxy and desktop
RUN apt-get -y update \
   && apt-get install -y  \
       dbus-x11 \
       libgl1-mesa-glx \
       firefox \
       xfce4 \
       xfce4-panel \
       xfce4-session \
       xfce4-settings \
       xorg \
       xubuntu-icon-theme \
    && rm -rf /tmp/*

# Remove light-locker to prevent screen lock
ARG TURBOVNC_VERSION=3.0.2
RUN wget -q "https://sourceforge.net/projects/turbovnc/files/${TURBOVNC_VERSION}/turbovnc_${TURBOVNC_VERSION}_amd64.deb/download" -O turbovnc_${TURBOVNC_VERSION}_amd64.deb && \
   apt-get install -y -q ./turbovnc_${TURBOVNC_VERSION}_amd64.deb && \
   apt-get remove -y -q light-locker && \
   rm ./turbovnc_${TURBOVNC_VERSION}_amd64.deb && \
   ln -s /opt/TurboVNC/bin/* /usr/local/bin/ \
    && rm -rf /tmp/*

USER $NB_USER

RUN pip install --no-cache-dir jupyter-remote-desktop-proxy

RUN mamba install --yes  websockify \
  && conda clean --all -f -y && rm -rf /tmp/*

RUN pip install --no-cache-dir itkwidgets

satra avatar Jan 20 '23 05:01 satra

@satra thank you for the nicely reproducible report! :clap: :-)

I tried it, but the image worked for me. Commands:

docker build -t proxy-issue .
cp ~/src/itkwidgets/examples/Hello3DWorld.ipynb .
docker run --rm -it -p 10000:8888 -v$(pwd):/home/jovyan/work/ proxy-issue:latest jupyter lab /home/jovyan/work/Hello3DWorld.ipynb 

The modification I made to the Dockerfile was:

#RUN pip install --no-cache-dir itkwidgets                                                                                                                                                                        
RUN pip install --no-cache-dir 'itkwidgets[lab]>=1.0a22'

Note the [lab] -- which is required in the 1.0 alpha versions. Maybe this was missing?

thewtex avatar Jan 20 '23 22:01 thewtex

@thewtex - may be i was too optimistic about the simplified state. the following should show the issue. also if you do: docker pull dandiarchive/dandihub:latest it should also be able to reuse those layers.

FROM jupyter/datascience-notebook:2023-01-16

USER root
ARG VERSION="1.1.5"

RUN wget -q https://github.com/apptainer/apptainer/releases/download/v${VERSION}/apptainer_${VERSION}_amd64.deb \
 && wget https://github.com/apptainer/apptainer/releases/download/v${VERSION}/apptainer-suid_${VERSION}_amd64.deb \
 && apt-get update && apt-get install --yes ./apptainer* \
 && rm apptainer*

RUN apt-get update && apt-get install -y ca-certificates libseccomp2 \
   uidmap squashfs-tools squashfuse fuse2fs fuse-overlayfs fakeroot \
   s3fs netbase less parallel tmux screen vim emacs htop curl \
   && rm -rf /tmp/*

RUN curl --silent --show-error "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" \
  -o "awscliv2.zip" && unzip awscliv2.zip \
  && ./aws/install && rm -rf ./aws awscliv2.zip

# Install jupyter server proxy and desktop
RUN apt-get -y update \
   && apt-get install -y  \
       dbus-x11 \
       libgl1-mesa-glx \
       firefox \
       xfce4 \
       xfce4-panel \
       xfce4-session \
       xfce4-settings \
       xorg \
       xubuntu-icon-theme \
    && rm -rf /tmp/*

# Remove light-locker to prevent screen lock
ARG TURBOVNC_VERSION=3.0.2
RUN wget -q "https://sourceforge.net/projects/turbovnc/files/${TURBOVNC_VERSION}/turbovnc_${TURBOVNC_VERSION}_amd64.deb/download" -O turbovnc_${TURBOVNC_VERSION}_amd64.deb && \
   apt-get install -y -q ./turbovnc_${TURBOVNC_VERSION}_amd64.deb && \
   apt-get remove -y -q light-locker && \
   rm ./turbovnc_${TURBOVNC_VERSION}_amd64.deb && \
   ln -s /opt/TurboVNC/bin/* /usr/local/bin/ \
    && rm -rf /tmp/*

# apt-get may result in root-owned directories/files under $HOME
RUN mkdir /opt/extras && chown -R $NB_UID:$NB_GID $HOME /opt/extras

USER $NB_USER

RUN pip install --no-cache-dir jupyter-remote-desktop-proxy

# Install Allen SDK
RUN mamba create --yes -n allen -c conda-forge python=3.8 pip ipykernel 'h5py>=3.4=mpi*' \
  && /opt/conda/envs/allen/bin/pip install --no-cache-dir allensdk \
  && conda clean --all -f -y && rm -rf /tmp/*

RUN mamba install --yes 'datalad>=0.16' rclone 'h5py>3.3=mpi*' ipykernel zarr blosc eccodes websockify \
  && wget --quiet https://raw.githubusercontent.com/DanielDent/git-annex-remote-rclone/v0.7/git-annex-remote-rclone \
  && chmod +x git-annex-remote-rclone && mv git-annex-remote-rclone /opt/conda/bin \
  && conda clean --all -f -y && rm -rf /tmp/*

RUN /opt/conda/envs/allen/bin/python -m ipykernel install --user --name allen \
    --display-name="Allen SDK"

RUN pip install --no-cache-dir 'itkwidgets[lab]>=1.0a22'

satra avatar Jan 20 '23 23:01 satra

@satra I tried as well with your most recent changes and @thewtex's commands but was also unable to reproduce the issue... Is there a specific notebook that you are seeing this issue with? Or any other steps we may be missing?

bnmajor avatar Jan 27 '23 15:01 bnmajor

@bnmajor - that is very surprising. i just did this on my M1 macos with the above content in a Dockerfile:

docker build -t dh --platform amd64 .
docker run -it --rm -p 8888:8888 --platform linux/amd64 dh

open the link showed when it runs and click on the Desktop icon.

satra avatar Jan 27 '23 15:01 satra

just to clarify the issue is with launching the desktop, which also uses the webproxy. somehow installing the itkwidgets lab prevents launching the desktop or imjoy for that matter. it generates a jupyter page with a 404 error.

satra avatar Jan 27 '23 16:01 satra

and for completeness: Docker version 20.10.21

satra avatar Jan 27 '23 16:01 satra

@satra Thank you for the additional details! Yes, following either approach allows me to access launch jupyter and run the notebook with no issues at 127.0.0.1:8888 (127.0.0.1:10000 in @thewtex example). I am unable to access the other link that is provided and I get tornado.web.HTTPError: HTTP 403: Forbidden. I see this same behavior when I use itkwidgets==0.32.5 as well.

If it would be helpful we could always set up a call/chat with @thewtex as well to try and get this sorted out

bnmajor avatar Jan 27 '23 16:01 bnmajor

I am wondering if this PR / issue by @oeway is related?

https://github.com/jupyterhub/jupyter-server-proxy/pull/181 https://github.com/jupyterhub/simpervisor/issues/6

Note that @oeway published a package with the patch (although a while ago) that can be installed with pip install jupyter-server-proxy-windows.

thewtex avatar Feb 22 '23 20:02 thewtex

@thewtex - i don't know. that seems windows specific and none of the systems we run are on windows.

are you still not able to reproduce the docker build issue? let's perhaps set up a time to do a quick screenshare.

satra avatar Feb 26 '23 20:02 satra

@satra the patched version of jupyter-server-proxy-windows had been pinned, and recently we removed that pin so the latest and greatest jupyter-server-proxy is used. Is there still an issue on your system?

thewtex avatar Oct 26 '23 18:10 thewtex

@thewtex - we can look into this on the next jupyterhub container update (cc: @aaronkanzer).

satra avatar Oct 29 '23 20:10 satra