[SOLVED] Latest RStudio will not work with JupyterHub or Binder, use R version 4.0

This is a general PSA because I’ve seen a few different JupyterHub deployments get burned by this recently. The goal of this post is just to tie together a few issues, provide cross-links, and maybe help point folks in the right direction.

The rsession proxy project is what makes it possible for people to run RStudio on a JupyterHub. This is used by JupyterHub and Binder.

The problem with updating RStudio

However, the latest version of RStudio introduced a bug that that breaks the redirection, as documented in this issue:

and discussed re: Binder here:

This bug is documented in this RStudio issue:

but thus far it seems like it won’t be a priority for them to fix for some time.

The problem with updating R 4.1

If you pin RStudio to 4.0, and continue updating the base R version, you’ll get an error about visualizations not working in RStudio and the visualizations won’t work. See this issue for one example of this problem:

What to do

Right now, there is no workaround that I know of for getting RStudio 4.1 to work on JupyterHub until [rserver auth redirect doesn't use www root path when X-Forwarded-Proto is set · Issue #8888 · rstudio/rstudio · GitHub] is resolved.

Your best bet is to pin R to v 4.0, that way an old version of RStudio works properly.

This issue discusses this in some detail, but it’s unclear to me what is the right path forward there: Pinning R 4.0 with runtime.txt on mybinder.org not working as expected · Issue #1077 · jupyterhub/repo2docker · GitHub

Do you know any other workarounds?

I know that’s not ideal - if anybody knows of another workaround for either JupyterHub or Binder please do share! We should update this thread if there’s a better solution that comes up.

1 Like

Hi @choldgraf thanks for raising this issue. In broad terms: I agree with your suggestion to use older versions of R for now, that seems to work for our newly updated Binder instance of the open source book Geocomputation with R: Binder

To see how I got this working again, see the .binder file of the associated repo.
Key to that approach is putting the following in environment.yml which uses the ‘r-conda’ version of R which is behind the latest version of R it seems:

name: geocompr
channels:
  - conda-forge
  - bioconda
  - r
dependencies:
  - r-base

A couple of questions:

  1. Is that stable and any ideas when ‘r-base’ in that set-up will switch?

  2. Could using a different graphics driver solve the issue? I’m thinking of ragg

1 Like

Here’s the code. Any comments on this welcome, I’m not sure if the ‘start’ file is needed… geocompr/.binder at main · Robinlovelace/geocompr · GitHub

A solution to this problem would be very much appreciated.
I successfully checked on https://mybinder.org/
Redirect client to auth-sign-in when not authenticated by ryanlovett · Pull Request #107 · jupyterhub/jupyter-rsession-proxy · GitHub .
I hope this could provide some insights.

jupyter-rsession-proxy version 2.0 fixes this! So latest RStudio now works again with jupyterhub. See A template repository for running latest RStudio + R on mybinder.org / your JupyterHub for an example.

You’ll need to make sure you’re on R 4.1, and jupyter-rsession-proxy >= 2.0.

Massive thanks to @ryanlovett and maresb for making this happen!

3 Likes

Amazing - thanks to all the folks that helped make this happen :heart:

Hello, I am getting a problem that could be related with this, I am using jupyterhub on kubernetes and when I build an image using older R version, it works correctly: I login to jupyterhub, a jupyterlab instance is launched and I can from there launch Rstudio and it appears in another tab as expected.

But when I try building an image with R 4.1 or greater, when I select Rstudio from the options on jupyterlab launch menu, it redirects to “https://access/user/\<my username>/rstudio/auth-sign-in?appUri=%2F” and page not found error appears on the browser.

I checked and I am using jupyter-rsession-proxy version 2.0.1 on the single user image, this is from the jupyterlab terminal:

luciano@jupyter:~$ pip show jupyter-rsession-proxy
Name: jupyter-rsession-proxy
Version: 2.0.1
Summary: Jupyter extension to proxy RStudio
Home-page: https://github.com/jupyterhub/jupyter-rsession-proxy
Author: Ryan Lovett & Yuvi Panda
Author-email: UNKNOWN
License: UNKNOWN
Location: /srv/conda/envs/notebook/lib/python3.7/site-packages
Requires: jupyter-server-proxy
Required-by: 

Probably I am missing something, but I cant find the issue.
If someone knows what I am doing wrong, maybe can help me

Thanks in advance!
Luciano

Sorry, Its not solved, in my case