rocker-org / rocker

R configurations for Docker
https://rocker-project.org
GNU General Public License v2.0
1.46k stars 271 forks source link

Making Conda installed R version work with Rstudio #384

Closed smk5g5 closed 4 years ago

smk5g5 commented 4 years ago

Hi I made a Docker image which looks like below : -

` FROM rocker/rstudio:latest RUN apt-get -qq update && apt-get -qq -y install curl bzip2 \ && curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh \ && bash /tmp/miniconda.sh -bfp /usr/local \ && rm -rf /tmp/miniconda.sh \ && conda install -y python=3 \ && conda update conda \ && apt-get -qq -y remove curl bzip2 \ && apt-get -qq -y autoremove \ && apt-get autoclean \ && rm -rf /var/lib/apt/lists/* /var/log/dpkg.log \ && conda clean --all --yes

RUN conda config --add channels bioconda && \ conda config --add channels conda-forge

RUN conda install nb_conda_kernels && \ conda install ipykernel && \ conda install r-irkernel && \ conda install -c anaconda jupyter && \ conda install -c conda-forge jupyterlab

RUN R --quiet -e "IRkernel::installspec(user=FALSE)"

Run conda create --name mycellassign -c bioconda r-cellassign RUN /bin/bash -c "source activate mycellassign && \ conda install -c bioconda scanpy && \ conda install -c bioconda bioconductor-singler && \ conda install bioconductor-scrnaseq && \ conda install -c bioconda bioconductor-singlecellexperiment && \ conda install -c bioconda bioconductor-scater && \ conda install -c bioconda bioconductor-scran && \ conda install -c bioconda bioconductor-summarizedexperiment && \ conda install -c bioconda r-garnett && \ conda install -c bioconda bioconductor-chetah && \ conda install -c bioconda r-seurat &&\ conda install nb_conda_kernels && \ conda install ipykernel && \ conda install r-irkernel && \ conda install -c anaconda jupyter && \ conda install -c conda-forge jupyterlab && \ pip install moana && \ R --quiet -e \"IRkernel::installspec(user=FALSE)\" && \ conda deactivate"

RUN conda init bash

ENV PATH="${PATH}:/usr/local/envs/mycellassign/bin/" ENV RSTUDIO_WHICH_R="${RSTUDIO_WHICH_R}:/usr/local/envs/mycellassign/bin/R" RUN conda activate mycellassign ` I am very new to using Docker and I have hit a stumbling block. I need to do two things but because of my limited knowledge of Docker I don't know how I would do it. So any help would be appreciated in that regard. 1. I need to disable the user authentication (for now) So I would appreciate it if you can help me with how to do it in the given Docker file. 2. I need to use the R in the conda environment "mycellassign". I tried to activate the environment in the docker file and also set RSTUDIO_WHICH_R variable to point to the specific R version that I am trying but that does not seem to work either. So I would appreciate any help in that regard. I had initially also tried to use R through jupyter notebook only but my jupyter notebook kept dying (kernel restart error) so now I was trying to use rstudio with the said conda environment but I am stuck and would appreciate any help.

Best regards!

eddelbuettel commented 4 years ago

Briefly:

i) Conda and plain R don't always mix well for all components, you want to consider all Conda solution ii) I don't know about RStudio with a Conda stack iii) If you want Conda, you should start from a Conda container.

I am closing this as it is not a Rocker bug -- we do not say we support Conda. Sorry!

smk5g5 commented 4 years ago

Unrelated with Conda how to bypass Rstudio login from Dockerfile?

eddelbuettel commented 4 years ago

Are you aware of https://github.com/rocker-org/rocker/wiki/Using-the-RStudio-image ? Have you search old issue tickets ? These questions have come up before (and, like this one, in the "wrong" repo -- it really belongs here where you should search too.

cboettig commented 4 years ago

@smk5g5 late this but if you're looking for a Jupyter environment, you might try https://github.com/rocker-org/binder (uses virtualenv instead of conda but may meet your requirements).

If you are looking to bypass authentication in RStudio, you might look at the website docs which show disabling auth:

docker run --rm \
  -p 127.0.0.1:8787:8787 \
  -e DISABLE_AUTH=true \
  rocker/rstudio

obviously use at your own risk, this is best for localhost only solutions with a firewall, hence the explicit localhost binding above.

If you're looking for other python environments, you might also check out the (experimental) ML images, https://github.com/rocker-org/ml. Not jupyter-based, but as you probably know, the RStudio interface and Rmd notebooks can run python code much like .ipynb notebooks run R code (and actually allow you to mix any languages instead of changing the whole notebook 'kernel').

Anyway, apologies these things aren't so easy to find, we're working on better docs. HTH