R in Jupyter under Linux

I would like to setup a Jupyter notebook with a R kernel in Linux (preferably Ubuntu, but I should probably be able to handle Debian). It will run on a remote server, and preferably in a Docker container, even if I may be able to make some preliminary experiments locally.

Can you point me to any useful resources? What should I install first of all? I guess I should use apt-get to install Python, R and Pip first of all. Then, pip install jupyter to install Jupyter. But after that, what else do I need to install in order for Jupyter to run a R kernel, instead than a Python one?

this is what you need


Maybe you can search internet first.

Indeed, I prefer RStudio Server more than Jupyter.

1 Like

Maybe you can search internet first.

Indeed, one should always "Google it before", and I did Google it, but I couldn't find the doc you're referring to: however, now it's one of the first links Google shows to me. I must have made some mistake before, but now it's not reproducible anymore, because Google has learnt from my browsing history that I'm interested in your link :slight_smile:
However, I see that installing it under Linux is not exactly easy: wish me luck.

It shouldn't be that hard. Here's how I do it on my Docker install. I'm using CentOS, so you'll need to replace the yum with apt-get`:

RUN yum install -y openssl-devel && \
    yum install -y libcurl-devel && \ 
    yum install -y libssh2-devel && \
    yum install -y libxml2-devel && \
    yum install -y R 

That gets me R. Then I copy over an R script to install the R kernel using IRkernel

ADD add_r_kernel.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/add_r_kernel.sh && \ 

my add_r_kernel.sh looks like this:




IRkernel::installspec(user = FALSE)

Thanks! I wouldn't have thought of the script. BTW, any specific reason why you're using CentOS rather than Ubuntu or Debian? And also, your name is not new to me...are you involved in some big OS project?

I just have a familiar face :wink:

I'm using CentOS only because we have an internal stack of tools built on CentOS, nothing to do with R. By building on my existing stack we can use our internal tools in Jupyter with Python and also fire up R kernels and have access to the same tools via Anaconda. Plus all the file system mounts are in place, which is nice. If I were just building an analytics platform, I'd probably use Ubuntu.

BTW, if you want to run R Studio Server from the same Docker image as your Jupyter Notebooks, check out nbrsessionproxy

1 Like

You read my mind :slight_smile: This could be very useful as an intermediate step for my use case. My final goal is to showcase only RStudio Server in Docker (no Jupyter), but since right now it doesn't work (proxy issues) while Jupyter does, I could use nbrsessionproxy to get users acquainted with RStudio, while I solve the proxy issues. Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.