Hi All,
Does anyone have experience successfully installing and loading the R package
?ggbreak? in a Docker container?
I ask because I have successfully used the ?ggbreak? package in a script outside
the Docker container (on my local computer), but for some reason, I get the
following error message when trying to load it using library(ggbreak) or
library(?ggbreak?) inside the same script that has been copied to the Docker
container:
Error in library(ggbreak) : there is no package called 'ggbreak'
Execution halted
I have tried installing ?ggbreak? using Bioconductor, the ?ggbreak? GitHub repo,
and the standard install.packages() function in R, and none have helped. The
image is building successfully; the issue is specifically when I run the
container, which generates the above error message. I am wondering if I am
missing some type of dependency upstream, or something else.
Please see the contents of the Dockerfile below:
FROM selenium/standalone-firefox:127.0
USER root
ENV SE_OFFLINE=true
ENV PATH "$PATH:/usr/bin/geckodriver"
ENV HOME "/root/"
RUN apt-get update \
    && apt install -y \
    software-properties-common \
    dirmngr \
    gnupg2 \
    wget \
    build-essential \
    libcurl4-openssl-dev \
    libxml2-dev \
    libasound2 \
#    libasound2t64 \
    python3 \
    python3-pip \
    python3.11-venv \
#    python3.12-venv \
    git-all \
    lsb-release \
    libxml-twig-perl \
    libc6-dev \
    vim \
    && wget -q -O -
https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc \
    | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc  \
    && add-apt-repository -y "ppa:marutter/rrutter4.0"
RUN apt-get update -y \
    && apt-get install -y r-base\
    && apt-get clean \
    && apt-get purge \
    && rm -rf /var/lib/apt/lists/* /tmp/*
RUN pip3 install --upgrade pip wheel setuptools>5
RUN pip3 install pandas
RUN pip3 install openpyxl
RUN pip3 install selenium-firefox
RUN pip3 install --no-cache-dir --upgrade rbase
RUN pip3 install webdriver-manager
RUN pip3 install 'rpy2>=3.5.12'
RUN pip3 install xlsxwriter
# Install additional R packages
# RUN R -e "install.packages(c('tools', 'ggplot2',
'ggbreak', 'ggrepel', 'stringr'),
repos='http://cran.us.r-project.org')"
RUN R -e "install.packages('tools',
repos='http://cran.us.r-project.org')"
RUN R -e "install.packages('ggplot2',
repos='http://cran.us.r-project.org')"
# RUN R -e "install.packages('ggbreak',
repos='http://cran.us.r-project.org')"
# RUN R -e "install.packages('remotes',
repos='http://cran.rstudio.com/')"
# RUN R -e "remotes::install_github('YuLab-SMU/ggbreak')"
RUN R -e "install.packages('ggrepel',
repos='http://cran.us.r-project.org')"
RUN R -e "install.packages('stringr',
repos='http://cran.us.r-project.org')"
RUN R -e "install.packages('BiocManager',
repos='http://cran.us.r-project.org')"
RUN R -e "BiocManager::install('ggbreak')"
# Create an app directory
RUN mkdir /app
RUN mkdir /volume_w_htmls
RUN mkdir /volume
RUN mkdir /volume2
RUN mkdir /home/seluser/Downloads
# Set the working directory
WORKDIR /app
# Copy bash script to Docker image
COPY ./webscraping_combined_boxplots.sh /app/webscraping_combined_boxplots.sh
# Make bash script executable
RUN chmod +x /app/webscraping_combined_boxplots.sh
ENTRYPOINT ["/app/webscraping_combined_boxplots.sh"]
CMD ["param1", "param2", "param3",
"param4", "param5", "param6", "param7",
"param8", "param9", "param10",
"param11", "param12", "param13",
"param14", "param15", "param16",
"param17", "param18", "param19"]
Would you please advise?
Thank you in advance for your help.
Br,
Lauren
--
Lauren J. Gerber
Bioinformatician
Precision Systems Medicine (Kallioniemi) Research Group
iCAN ? Digital Precision Cancer Medicine Flagship
Institute for Molecular Medicine Finland (FIMM)
Nordic EMBL Partnership for Molecular Medicine
Biomedicum Helsinki 2U, D301a1
P.O. Box 20 (Tukholmankatu 8)
FI-00014 University of Helsinki, Finland
lauren.gerber at helsinki.fi
	[[alternative HTML version deleted]]
James W. MacDonald
2024-Oct-15  13:21 UTC
[R-sig-Debian] R Package: 'ggbreak' in Dockerfile
Don't you have to load BiocManager before using it?
-----Original Message-----
From: R-SIG-Debian <r-sig-debian-bounces at r-project.org> On Behalf Of
Gerber, Lauren J
Sent: Tuesday, October 15, 2024 9:15 AM
To: r-sig-debian at r-project.org
Cc: dirk at eddelbuettel.com
Subject: Re: [R-sig-Debian] R Package: 'ggbreak' in Dockerfile
Hi All,
Does anyone have experience successfully installing and loading the R package 
ggbreak  in a Docker container?
I ask because I have successfully used the  ggbreak  package in a script outside
the Docker container (on my local computer), but for some reason, I get the
following error message when trying to load it using library(ggbreak) or
library( ggbreak ) inside the same script that has been copied to the Docker
container:
Error in library(ggbreak) : there is no package called 'ggbreak'
Execution halted
I have tried installing  ggbreak  using Bioconductor, the  ggbreak  GitHub repo,
and the standard install.packages() function in R, and none have helped. The
image is building successfully; the issue is specifically when I run the
container, which generates the above error message. I am wondering if I am
missing some type of dependency upstream, or something else.
Please see the contents of the Dockerfile below:
FROM selenium/standalone-firefox:127.0
USER root
ENV SE_OFFLINE=true
ENV PATH "$PATH:/usr/bin/geckodriver"
ENV HOME "/root/"
RUN apt-get update \
    && apt install -y \
    software-properties-common \
    dirmngr \
    gnupg2 \
    wget \
    build-essential \
    libcurl4-openssl-dev \
    libxml2-dev \
    libasound2 \
#    libasound2t64 \
    python3 \
    python3-pip \
    python3.11-venv \
#    python3.12-venv \
    git-all \
    lsb-release \
    libxml-twig-perl \
    libc6-dev \
    vim \
    && wget -q -O -
https://urldefense.com/v3/__https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc__;!!K-Hz7m0Vt54!j4qWJp3neZb132HVgGwaZ3mog2adnEcdl8X0OTb3wuUcviOwwus9E8QSsmCmKta8dZ-FmpzQOKC7qePXnj1qvC-XQQ$
\
    | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc  \
    && add-apt-repository -y "ppa:marutter/rrutter4.0"
RUN apt-get update -y \
    && apt-get install -y r-base\
    && apt-get clean \
    && apt-get purge \
    && rm -rf /var/lib/apt/lists/* /tmp/*
RUN pip3 install --upgrade pip wheel setuptools>5 RUN pip3 install pandas RUN
pip3 install openpyxl RUN pip3 install selenium-firefox RUN pip3 install
--no-cache-dir --upgrade rbase RUN pip3 install webdriver-manager RUN pip3
install 'rpy2>=3.5.12'
RUN pip3 install xlsxwriter
# Install additional R packages
# RUN R -e "install.packages(c('tools', 'ggplot2',
'ggbreak', 'ggrepel', 'stringr'),
repos='https://urldefense.com/v3/__http://cran.us.r-project.org__;!!K-Hz7m0Vt54!j4qWJp3neZb132HVgGwaZ3mog2adnEcdl8X0OTb3wuUcviOwwus9E8QSsmCmKta8dZ-FmpzQOKC7qePXnj0ggNUwsA$
')"
RUN R -e "install.packages('tools',
repos='https://urldefense.com/v3/__http://cran.us.r-project.org__;!!K-Hz7m0Vt54!j4qWJp3neZb132HVgGwaZ3mog2adnEcdl8X0OTb3wuUcviOwwus9E8QSsmCmKta8dZ-FmpzQOKC7qePXnj0ggNUwsA$
')"
RUN R -e "install.packages('ggplot2',
repos='https://urldefense.com/v3/__http://cran.us.r-project.org__;!!K-Hz7m0Vt54!j4qWJp3neZb132HVgGwaZ3mog2adnEcdl8X0OTb3wuUcviOwwus9E8QSsmCmKta8dZ-FmpzQOKC7qePXnj0ggNUwsA$
')"
# RUN R -e "install.packages('ggbreak',
repos='https://urldefense.com/v3/__http://cran.us.r-project.org__;!!K-Hz7m0Vt54!j4qWJp3neZb132HVgGwaZ3mog2adnEcdl8X0OTb3wuUcviOwwus9E8QSsmCmKta8dZ-FmpzQOKC7qePXnj0ggNUwsA$
')"
# RUN R -e "install.packages('remotes',
repos='https://urldefense.com/v3/__http://cran.rstudio.com/__;!!K-Hz7m0Vt54!j4qWJp3neZb132HVgGwaZ3mog2adnEcdl8X0OTb3wuUcviOwwus9E8QSsmCmKta8dZ-FmpzQOKC7qePXnj1ACvaCfA$
')"
# RUN R -e "remotes::install_github('YuLab-SMU/ggbreak')"
RUN R -e "install.packages('ggrepel',
repos='https://urldefense.com/v3/__http://cran.us.r-project.org__;!!K-Hz7m0Vt54!j4qWJp3neZb132HVgGwaZ3mog2adnEcdl8X0OTb3wuUcviOwwus9E8QSsmCmKta8dZ-FmpzQOKC7qePXnj0ggNUwsA$
')"
RUN R -e "install.packages('stringr',
repos='https://urldefense.com/v3/__http://cran.us.r-project.org__;!!K-Hz7m0Vt54!j4qWJp3neZb132HVgGwaZ3mog2adnEcdl8X0OTb3wuUcviOwwus9E8QSsmCmKta8dZ-FmpzQOKC7qePXnj0ggNUwsA$
')"
RUN R -e "install.packages('BiocManager',
repos='https://urldefense.com/v3/__http://cran.us.r-project.org__;!!K-Hz7m0Vt54!j4qWJp3neZb132HVgGwaZ3mog2adnEcdl8X0OTb3wuUcviOwwus9E8QSsmCmKta8dZ-FmpzQOKC7qePXnj0ggNUwsA$
')"
RUN R -e "BiocManager::install('ggbreak')"
# Create an app directory
RUN mkdir /app
RUN mkdir /volume_w_htmls
RUN mkdir /volume
RUN mkdir /volume2
RUN mkdir /home/seluser/Downloads
# Set the working directory
WORKDIR /app
# Copy bash script to Docker image
COPY ./webscraping_combined_boxplots.sh /app/webscraping_combined_boxplots.sh
# Make bash script executable
RUN chmod +x /app/webscraping_combined_boxplots.sh
ENTRYPOINT ["/app/webscraping_combined_boxplots.sh"]
CMD ["param1", "param2", "param3",
"param4", "param5", "param6", "param7",
"param8", "param9", "param10",
"param11", "param12", "param13",
"param14", "param15", "param16",
"param17", "param18", "param19"]
Would you please advise?
Thank you in advance for your help.
Br,
Lauren
--
Lauren J. Gerber
Bioinformatician
Precision Systems Medicine (Kallioniemi) Research Group iCAN   Digital Precision
Cancer Medicine Flagship Institute for Molecular Medicine Finland (FIMM) Nordic
EMBL Partnership for Molecular Medicine Biomedicum Helsinki 2U, D301a1 P.O. Box
20 (Tukholmankatu 8)
FI-00014 University of Helsinki, Finland lauren.gerber at helsinki.fi
	[[alternative HTML version deleted]]
? Tue, 15 Oct 2024 13:14:49 +0000 "Gerber, Lauren J" <lauren.gerber at helsinki.fi> ?????:> RUN R -e "BiocManager::install('ggbreak')"> ENTRYPOINT ["/app/webscraping_combined_boxplots.sh"]> Error in library(ggbreak) : there is no package called 'ggbreak' > Execution haltedDoes the container build process produce any kind of log output? What is the library path where the package ends up being installed by BiocManager? When you run R from webscraping_combined_boxplots.sh, do you set R_LIBS or R_LIBS_USER or any other related environment variables (documented in ?Startup) that may affect the set of libraries considered by R when loading the 'ggbreak' package? In particular, is the library where BiocManager::install('ggbreak') installs the package present in the list returned by .libPaths()? -- Best regards, Ivan