How can I correctly use phyloseq with Docker?
1
1
Entering edit mode
@89e4e95d
Last seen 6 months ago
Switzerland

Hi everyone, I just need some help. I'm sure someone already had the same problem.

I've got a shiny app which uses phyloseq, but somehow when I create the image and want to start the image I always get the same error

    Error in library(): ! there is no package called 'phyloseq' Backtrace: 1. base::library(phyloseq) Execution halted

I really don't know where the problem is, first I thought there's a version problem with R and Bioconductor so I changed the R version to 3.4.2. However this didn't work, at the same time I also tried to take the BiocManager version 3.18 which should be compatible with with the R version I've got. Also no results.

After some hours spent, I now desperately search for some help, and hope that someone could help.

Below you'll see the Dockerfile I've got.

If someone know the problem or could help here I'd be very thankful.

FROM rocker/shiny:4.3.2


RUN wget https://quarto.org/download/latest/quarto-linux-amd64.deb && \
    dpkg -i quarto-linux-amd64.deb && \
    rm quarto-linux-amd64.deb


RUN R -e "install.packages('tinytex'); tinytex::install_tinytex()"


RUN apt-get update && apt-get install -y \
  libcurl4-openssl-dev \
  libssl-dev \
  libxml2-dev \
  libxt6 \
  libxrender1 \
  libfontconfig1 \
  libharfbuzz-dev \
  libfribidi-dev \
  zlib1g-dev \
  git


# Install CRAN packages
RUN R -e "install.packages(c( \
  'shiny', 'bslib', 'bsicons', 'tidyverse', 'DT', 'plotly', 'readxl', 'tools', \
  'knitr', 'kableExtra', 'base64enc', 'ggrepel', 'pheatmap', 'viridis', 'gridExtra', \
  'quarto' \
))"


# Install Bioconductor and required packages
RUN R -e "install.packages('BiocManager')"
RUN R -e "BiocManager::install(version = '3.18')"
RUN R -e "BiocManager::install('phyloseq', dependencies = TRUE, ask = FALSE)"
RUN R -e "BiocManager::install('DESeq2', dependencies = TRUE, ask = FALSE)"
RUN R -e "BiocManager::install('apeglm', dependencies = TRUE, ask = FALSE)"
RUN R -e "BiocManager::install('vegan', dependencies = TRUE, ask = FALSE)"


COPY src/ /srv/shiny-server/
COPY data/ /srv/shiny-server/data/
RUN chown -R shiny:shiny /srv/shiny-server

USER shiny

EXPOSE 3838 

CMD ["/usr/bin/shiny-server"]
phylo phyloseq Docker • 1.7k views
ADD COMMENT
0
Entering edit mode

You show how you modified the container, but not how you are running it, which is the critical part.

ADD REPLY
0
Entering edit mode

You can use bioc-run to simplify things as well.

ADD REPLY
0
Entering edit mode
Kevin Blighe ★ 4.0k
@kevin
Last seen 2 hours ago
The Cave, 181 Longwood Avenue, Boston, …

The Bioconductor version must be compatible with the R version. Bioconductor version 3.18 is compatible with R version 4.3. The Dockerfile that you provided uses rocker/shiny:4.3.2, which is R version 4.3.2. This is correct.

You mentioned that you changed the R version to 3.4.2. This version of R is not compatible with Bioconductor version 3.18. For R version 3.4.2, you must use Bioconductor version 3.6 or earlier.

If you intend to use R version 4.3.2, retain the base image rocker/shiny:4.3.2 in the Dockerfile. Build the image and examine the build logs to confirm that the installation of phyloseq completed without errors.

To test the installation during the build, add this line after the BiocManager installation commands in the Dockerfile:

RUN R -e "require('phyloseq')"

Rebuild the image. If the build fails, the installation of phyloseq did not succeed. Inspect the logs for the cause, such as network issues or missing dependencies.

If the build succeeds but the runtime error persists, run the container interactively to test as the shiny user:

docker run -it --entrypoint /bin/bash your_image_name

Inside the container, execute:

su - shiny
R
library(phyloseq)

If this command fails, the package is not accessible to the shiny user. In that case, consider installing the R packages after switching to the shiny user in the Dockerfile, though system libraries installed as root should be visible.

As an alternative, use the official Bioconductor Docker images with the bioc-run script for easier management. Details are available at the Bioconductor Docker help page.

Kevin

ADD COMMENT

Login before adding your answer.

Traffic: 960 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6