I created a GitHub repository containing two scripts that allow you to start Rstudio server in non-daemonized mode from within a Conda environment: rstudio-server-conda.
How it works:
You can start rstudio-server in the non-daemonized mode (similar to jupyter notebook
) from within a
Conda environment.
> conda activate my_project
> /usr/lib/rstudio-server/bin/rserver \
--server-daemonize=0 \
--www-port 8787 \
--rsession-which-r=$(which R) \
--rsession-ld-library-path=$CONDA_PREFIX/lib
To avoid additional problems with library paths, also rsession
needs to run within the Conda environment. This is achieved by wrapping rsession into the rsession.sh script. The path to the wrapped rsession executable can be passed to rserver as command line argument.
rserver # ...
--rsession-path=rsession.sh
Finally, when using multiple users a unique secret-cookie-key
has to be generated for each user. The path to the secret cookie key can be passed to rserver as a command line parameter.
uuid > /tmp/rstudio-server/${USER}_secure-cookie-key
rserver # ...
--secure-cookie-key-file /tmp/rstudio-server/${USER}_secure-cookie-key