repo2docker icon indicating copy to clipboard operation
repo2docker copied to clipboard

Unable to launch RStudio from repo2docker

Open sgibson91 opened this issue 2 years ago • 9 comments

Bug description

I am unable to access RStudio from a repo2docker container including R. I think some of the issues may be being discussed in the discourse thread but I'm not sure if my issue is directly related or not.

Expected behaviour

RStudio launches without error when I click the RStudio button in the launcher, or I manipulate the URL to end in /rstudio

Actual behaviour

I try to launch RStudio from a running repo2docker container, both by URL manipulation and by selecting RStudio from the launcher, and I receive an error message.

Note that R itself still works if I launch an R console, I just can't access RStudio. I have also tried on mybinder.org, and had to follow the workaround suggested in this discourse comment: https://discourse.jupyter.org/t/r-conda-example-repo-isnt-working-any-more/21739/8

How to reproduce

  1. Locally clone this branch: https://github.com/sgibson91/fair-research-software/tree/binderize config files are located in the .binder folder
  2. Run repo2docker . in the repo
  3. Access the container via the browser
  4. Attempt to launch RStudio either by clicking the RStudio button in the launcher, or by manipulating the URL to end with /rstudio
  5. See the error captured in screenshot below
Screenshot 2023-10-20 at 13 49 50

Logs from repo2docker are:

[I 12:48:48.803 NotebookApp] 302 GET /?token=REDACTED (192.168.65.1) 10.710000ms
[I 12:48:52.629 NotebookApp] 301 GET /static/favicons/favicon.ico (192.168.65.1) 1.090000ms
[W 12:48:53.102 NotebookApp] 404 GET /api/me?1697806132708 (192.168.65.1) 59.770000ms referer=http://127.0.0.1:52854/lab
[I 2023-10-20 12:48:56.722 LabApp] Build is up to date
[W 12:49:01.904 NotebookApp] 404 GET /studio (192.168.65.1) 5.110000ms referer=None
[I 12:49:10.197 NotebookApp] 302 GET /rstudio (192.168.65.1) 2.850000ms
[I 12:49:14.464 NotebookApp] 302 GET /rstudio/ (192.168.65.1) 4249.390000ms
[I 12:49:14.516 NotebookApp] 302 GET /rstudio/auth-sign-in?appUri=%2F (192.168.65.1) 20.140000ms

I also tried the suggestion here to launch directly into RStudio and got the following message (which isn't explicitly an error, but I didn't get a browser with RStudio either):

/srv/conda/envs/notebook/lib/python3.10/subprocess.py:961: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
  self.stdout = io.open(c2pread, 'rb', bufsize)
CONTAINER FINISHED RUNNING.

Your personal set up

  • OS: OSX Ventura 13.5.2
  • Docker version: docker version
Client: Docker Engine - Community
 Version:           24.0.6
 API version:       1.43
 Go version:        go1.21.0
 Git commit:        ed223bc820
 Built:             Thu Aug 31 17:24:32 2023
 OS/Arch:           darwin/amd64
 Context:           desktop-linux

Server: Docker Desktop 4.24.2 (124339)
 Engine:
  Version:          24.0.6
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.7
  Git commit:       1a79695
  Built:            Mon Sep  4 12:32:16 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.22
  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca
 runc:
  Version:          1.1.8
  GitCommit:        v1.1.8-0-g82f18fe
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
  • repo2docker version repo2docker --version: 2023.06.0+39.g8bdf681 I installed from main following advice here: https://discourse.jupyter.org/t/mybinder-and-binderhub-fails-for-conda-environment-yml-containing-python-dependency/21978/3

sgibson91 avatar Oct 20 '23 14:10 sgibson91

It's working for me on OVH with the latest r2d (freshly deployed):

  • https://gist.github.com/manics/cbb7a31427d316772bc1c33b087d526b
  • https://mybinder.org/v2/gist/manics/cbb7a31427d316772bc1c33b087d526b/HEAD?urlpath=rstudio

manics avatar Oct 20 '23 17:10 manics

Cool, I'll rebuild mine to see if that's working on binder too now.

I'm still seeing this error when using r2d from the command line though

Screenshot 2023-10-20 at 19 11 27

sgibson91 avatar Oct 20 '23 18:10 sgibson91

Yeah, I can reproduce that too locally.....

...
[I 18:14:12.578 NotebookApp] 302 GET /rstudio (10.4.0.1) 12.940000ms
[I 18:14:17.501 NotebookApp] 302 GET /rstudio/ (10.4.0.1) 4600.290000ms
[I 18:14:17.570 NotebookApp] 302 GET /rstudio/auth-sign-in?appUri=%2F (10.4.0.1) 66.040000ms

@ryanlovett Do you think it's anything to do with https://github.com/jupyterhub/jupyter-rsession-proxy ?

manics avatar Oct 20 '23 18:10 manics

Hi @manics, I just tried installing repo2docker main into a fresh conda env, and executed it in a local working directory of https://github.com/sgibson91/fair-research-software from the main branch since the binderize branch no longer exists. The image built and ran, and I was able to successfully access RStudio by clicking on its launcher button in Lab.

ryanlovett avatar Oct 25 '23 17:10 ryanlovett

I also tried a fresh conda env, installing repo2docker from main and trying the same repo again (main branch), and I get the same error when trying to launch RStudio.

sgibson91 avatar Oct 25 '23 18:10 sgibson91

Strangely it's working for me too now ¯\_(ツ)_/¯

manics avatar Oct 25 '23 19:10 manics

Actually no it's not..... rstudio initially loads, but after a few seconds it fails, and the logs are full of

[I 19:40:30.072 NotebookApp] 302 GET /rstudio/auth-sign-in (10.0.2.100) 6.030000ms
[I 19:40:37.480 NotebookApp] 302 GET /rstudio/auth-sign-in (10.0.2.100) 5.610000ms
[I 19:40:44.825 NotebookApp] 302 GET /rstudio/auth-sign-in (10.0.2.100) 5.360000ms

manics avatar Oct 25 '23 19:10 manics

Hmm, I'm unable to reproduce. I left my rstudio session from yesterday alone (spawned from repo2docker > lab > rstudio), and it is still running and can execute code. I can try reproducing on another device however.

In the meantime, can you confirm that your repo2docker installed the right version of jupyter-rsession-proxy? What does mamba list report from inside the container?

ryanlovett avatar Oct 26 '23 21:10 ryanlovett

I've pushed the image to docker.io/manics/repo2docker-issue1316 so you can pull it if you want

repo2docker --engine podman --image-name docker.io/manics/repo2docker-issue1316 --no-run https://github.com/sgibson91/fair-research-software

podman push docker.io/manics/repo2docker-issue1316

This is the command I've been using to test (mimics the default command and args set by repo2docker): podman run -it --rm -p 42151:42151 docker.io/manics/repo2docker-issue1316 jupyter notebook --ip=0.0.0.0 --port=42151 --NotebookApp.custom_display_url=http://127.0.0.1:42151 --NotebookApp.default_url=/lab but I can't reproduce it at the moment, RStudio is working.

$ $ podman run -it --rm docker.io/manics/repo2docker-issue1316 mamba list | grep jupyter
jupyter-offlinenotebook   0.2.2              pyh1d7be83_0    conda-forge
jupyter-resource-usage    0.7.1              pyhd8ed1ab_0    conda-forge
jupyter-rsession-proxy    2.2.0                    pypi_0    pypi
jupyter-server-proxy      4.1.0                    pypi_0    pypi
jupyter-shiny-proxy       1.1                      pypi_0    pypi
jupyter_client            7.4.9              pyhd8ed1ab_0    conda-forge
jupyter_core              5.4.0           py310hff52083_0    conda-forge
jupyter_events            0.7.0              pyhd8ed1ab_2    conda-forge
jupyter_server            1.24.0             pyhd8ed1ab_0    conda-forge
jupyter_server_fileid     0.9.0              pyhd8ed1ab_0    conda-forge
jupyter_server_ydoc       0.8.0              pyhd8ed1ab_0    conda-forge
jupyter_telemetry         0.1.0              pyhd8ed1ab_1    conda-forge
jupyter_ydoc              0.2.4              pyhd8ed1ab_0    conda-forge
jupyterhub-base           3.1.1              pyh2a2186d_0    conda-forge
jupyterhub-singleuser     3.1.1              pyh2a2186d_0    conda-forge
jupyterlab                3.6.6              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.2.2              pyhd8ed1ab_0    conda-forge
jupyterlab_server         2.25.0             pyhd8ed1ab_0    conda-forge
jupyterlab_widgets        3.0.9              pyhd8ed1ab_0    conda-forge

manics avatar Oct 26 '23 23:10 manics