Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to build container with docker #173

Closed
B0BYorgurt opened this issue Apr 13, 2024 · 5 comments
Closed

unable to build container with docker #173

B0BYorgurt opened this issue Apr 13, 2024 · 5 comments

Comments

@B0BYorgurt
Copy link

Help!
I am unable to build container with docker with the method described under the heading of "Using alternative Rocker images":

I am trying to recreate an environment to replicate some single cell analysis with some old codes written by previous postdocs in the lab. The analysis is done with Seurat 3.1 but current versions of R no longer support such package, and I have spend a whole day futilely looking into how to install historic versions of R in a Windows OS, before seeing this thread.

This is what I did on my Rstudio:

install.packages("rang") library(rang) x <- resolve(pkgs = c("Seurat", "magrittr", "data.table"), snapshot_date = "2019-09-01") dockerize(x, "~/rocker_test")

Everything went smooth and there is no warning.

However, when I tried to use docker to build the container with the codes provided:
cd ~/rocker_test docker build -t rang . docker run --rm --name "rangtest" -ti rang

The build failed with such messages:
Screenshot 2024-04-13 021902

Could anyone tell me how to troubleshoot or if there is better way than going through this container thing to achieve my goal (e.g., to install R version 3.6.1 on my Windows PC).
Sorry if the question looks stupid because I am totally new to bioinformatics and IT stuff...

Thank you!

@chainsawriot
Copy link
Collaborator

@B0BYorgurt Don't worry, there are no stupid question in this area because these problems involve a lot of moving parts. And therefore, the solution is not trivial.

We know this problem (see #140 ). The quick fix to this problem is to add this line before RUN apt-get update... to the generated Dockerfile

RUN sed -i -e 's/deb.debian.org/archive.debian.org/g' \
           -e 's|security.debian.org|archive.debian.org/|g' \
           -e '/stretch-updates/d' /etc/apt/sources.list

Therefore, the Dockerfile should be

FROM rocker/r-ver:3.6.1
ENV RANG_PATH /rang.R
COPY rang.R /rang.R
RUN sed -i -e 's/deb.debian.org/archive.debian.org/g' \
           -e 's|security.debian.org|archive.debian.org/|g' \
           -e '/stretch-updates/d' /etc/apt/sources.list
RUN apt-get update -qq \
        && apt-get install -y libpcre3-dev zlib1g-dev pkg-config libcurl4-openssl-dev \
        && apt-get install -y libcurl4-openssl-dev libfftw3-dev libglpk-dev libicu-dev libpng-dev libssl-dev libxml2-dev make pandoc python3 zlib1g-dev
RUN Rscript $RANG_PATH
CMD ["R"]

And I have tried, it can generate a Docker image that can run Seurat 3.1.

@B0BYorgurt
Copy link
Author

@B0BYorgurt Don't worry, there are no stupid question in this area because these problems involve a lot of moving parts. And therefore, the solution is not trivial.

We know this problem (see #140 ). The quick fix to this problem is to add this line before RUN apt-get update... to the generated Dockerfile

RUN sed -i -e 's/deb.debian.org/archive.debian.org/g' \
           -e 's|security.debian.org|archive.debian.org/|g' \
           -e '/stretch-updates/d' /etc/apt/sources.list

Therefore, the Dockerfile should be

FROM rocker/r-ver:3.6.1
ENV RANG_PATH /rang.R
COPY rang.R /rang.R
RUN sed -i -e 's/deb.debian.org/archive.debian.org/g' \
           -e 's|security.debian.org|archive.debian.org/|g' \
           -e '/stretch-updates/d' /etc/apt/sources.list
RUN apt-get update -qq \
        && apt-get install -y libpcre3-dev zlib1g-dev pkg-config libcurl4-openssl-dev \
        && apt-get install -y libcurl4-openssl-dev libfftw3-dev libglpk-dev libicu-dev libpng-dev libssl-dev libxml2-dev make pandoc python3 zlib1g-dev
RUN Rscript $RANG_PATH
CMD ["R"]

And I have tried, it can generate a Docker image that can run Seurat 3.1.

@chainsawriot
Thank you so much for your prompt reply and very kind words!
What you suggested worked and I am crying happy tears!
I don't know what to say!

@B0BYorgurt
Copy link
Author

@B0BYorgurt Don't worry, there are no stupid question in this area because these problems involve a lot of moving parts. And therefore, the solution is not trivial.

We know this problem (see #140 ). The quick fix to this problem is to add this line before RUN apt-get update... to the generated Dockerfile

RUN sed -i -e 's/deb.debian.org/archive.debian.org/g' \
           -e 's|security.debian.org|archive.debian.org/|g' \
           -e '/stretch-updates/d' /etc/apt/sources.list

Therefore, the Dockerfile should be

FROM rocker/r-ver:3.6.1
ENV RANG_PATH /rang.R
COPY rang.R /rang.R
RUN sed -i -e 's/deb.debian.org/archive.debian.org/g' \
           -e 's|security.debian.org|archive.debian.org/|g' \
           -e '/stretch-updates/d' /etc/apt/sources.list
RUN apt-get update -qq \
        && apt-get install -y libpcre3-dev zlib1g-dev pkg-config libcurl4-openssl-dev \
        && apt-get install -y libcurl4-openssl-dev libfftw3-dev libglpk-dev libicu-dev libpng-dev libssl-dev libxml2-dev make pandoc python3 zlib1g-dev
RUN Rscript $RANG_PATH
CMD ["R"]

And I have tried, it can generate a Docker image that can run Seurat 3.1.

@chainsawriot I just encountered some more problem running Seurat 3.1 with the rstudio versioned Docker container. I ran a UMAP command:
SeuratObj<- RunUMAP(SeuratObj, dims = 1:20)
and received error saying:

Error in initialize_python(required_module, use_environment) : 
  Python shared library not found, Python bindings not loaded.

Looks like the Python PATH of the image is not specified?

I did Sys.getenv() on the rstudio container and I got message of:

... LD_LIBRARY_PATH /usr/local/lib/R/lib::/lib:/usr/local/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server ... PATH /usr/bin:/usr/lib/rstudio-server/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/bin ... RMARKDOWN_MATHJAX_PATH /usr/lib/rstudio-server/resources/mathjax-26 RS_RPOSTBACK_PATH /usr/lib/rstudio-server/bin/rpostback USER rstudio

I do not see a PATH for Python and don't know how to fix this...

Thank you!

@B0BYorgurt B0BYorgurt reopened this Apr 14, 2024
@chainsawriot
Copy link
Collaborator

@B0BYorgurt TBH, it is now way beyond the scope of rang (at least in my view, rang has done what it can done) and you should seek help from the Seurat team (@satijalab please help). And it's now getting super tricky, as I didn't know the package was using reticulate. And that's PITA.

To answer your question, yes: there is at least one Python installation (Python 3.5) in the Docker image.

docker run -ti --entrypoint bash rang

And then

whereis python
/usr/bin/python3.5

Now, reading the help file of RunUMAP (at the version inside the image), it says:

 Runs the Uniform Manifold Approximation and Projection (UMAP)
 dimensional reduction technique. To run, you must first install
 the umap-learn python package (e.g. via ‘pip install umap-learn’).
 Details on this package can be found here: <URL:
 https://github.com/lmcinnes/umap>. For a more in depth discussion
 of the mathematics underlying UMAP, see the ArXiv paper here:
 <URL: https://arxiv.org/abs/1802.03426>.

The installation and configuration of the Python package were manual. Maybe you should also read this:

satijalab/seurat#1020

I am sorry to say this, but that's the limit of my technical support. Please seek for help there. Thank you very much!

@B0BYorgurt
Copy link
Author

@chainsawriot
You've helped me the best you could and I am grateful wholeheartedly.
Turns out it is very complicated. I think for now I will just work around with new codes and environment unless it is necessary to use the historic environment. If that is the case I will contact the Seurat group.
Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants