You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Quarto website I have built and want to host after it has been containerized in Docker. I can build the Docker image locally, but I am having issues trying to build it using an Azure DevOps Pipeline. The issue seems to stem from when I try to install specific versions of packages I want using pak.
The overview of the Dockerfile's steps:
Uses Rocker's r-ver image to build the website.
Install Linux libraries, Quarto, and Python from source.
Create folders and set non-root permissions.
Install pak with hard-coded URL.
Install renv version 0.15.5.
# Base R imageFROM rocker/r-ver:4.1.2 AS builder
# Install Linux libraries required by R and Python package stored in the# `renv.lock` and `requirements.txt` files, respectively. RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libcurl4-openssl-dev \
libssl-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Quarto# https://docs.posit.co/resources/install-quarto.html#RUN export QUARTO_VERSION="1.4.555"RUN mkdir -p /opt/quarto/1.4.555
RUN curl -o quarto.tar.gz -L \
"https://github.com/quarto-dev/quarto-cli/releases/download/v1.4.555/quarto-1.4.555-linux-amd64.tar.gz"RUN tar -zxvf quarto.tar.gz \
-C "/opt/quarto/1.4.555" \
--strip-components=1
RUN rm quarto.tar.gz
# Install Python from source.# https://docs.posit.co/resources/install-python-source.html#RUN export PYTHON_VERSION="3.10.9"RUN apt-get update \
&& apt-get install -y --no-install-recommends \
gcc \
libbz2-dev \
libev-dev \
libffi-dev \
libgdbm-dev \
liblzma-dev \
libncurses-dev \
libreadline-dev \
libsqlite3-dev \
make \
tk-dev \
wget \
zlib1g-dev
RUN curl -O https://www.python.org/ftp/python/3.10.9/Python-3.10.9.tgz
RUN tar -xvzf Python-3.10.9.tgz
WORKDIR Python-3.10.9
RUN ./configure \
--prefix=/opt/python/3.10.9 \
--enable-shared \
--enable-optimizations \
--enable-ipv6 \
LDFLAGS=-Wl,-rpath=/opt/python/3.10.9/lib,--disable-new-dtags
RUN make
RUN make install
# Install pip.# https://docs.posit.co/resources/install-python-source.html#install-pipRUN curl -O https://bootstrap.pypa.io/get-pip.py
RUN /opt/python/3.10.9/bin/python3.10 get-pip.py
# Make a directory in the containerWORKDIR /
RUN mkdir /app
RUN chown 1000 /app
# Change working directory to `/app` to replicate how users interact# with the repository.WORKDIR /app
# Install `pak`# Switch the default CRAN mirror# https://rocker-project.org/images/versioned/r-ver.html#switch-the-default-cran-mirrorRUN R -e "options(repos = c(CRAN = 'https://cloud.r-project.org', P3M = 'https://packagemanager.posit.co/cran/__linux__/jammy/latest'))"RUN R -e "install.packages('https://cloud.r-project.org/src/contrib/Archive/pak/pak_0.7.2.tar.gz')"# Install `renv` and `reticulate`.RUN R -e "pak::pkg_install(pkg = '[email protected]')"
The pak::pkg_install(pkg = '[email protected]') install returns an error that I cannot understand why it is happening. My interpretation is that it downloads renv version 0.15.4 instead of 0.15.5 that I specified. I believe it may have to do with the fact that my options() call is not being carried forward when I call pak, as I see pak says it Failed to download renv from 'https://packagemanager.posit.co/cran/__linux__/focal/2022-03-09/src/contrib/renv_0.15.4.tar.gz' and 'https://packagemanager.posit.co/cran/__linux__/focal/2022-03-09/src/contrib/Archive/renv/renv_0.15.4.tar.gz'.
2024-09-25T15:40:00.3152745Z#30 [builder 21/38] RUN R -e "pak::pkg_install(pkg = '[email protected]')"2024-09-25T15:40:00.4885244Z#30 0.324 2024-09-25T15:40:00.4885888Z#30 0.324 R version 4.1.2 (2021-11-01) -- "Bird Hippie"2024-09-25T15:40:00.4886280Z#30 0.324 Copyright (C) 2021 The R Foundation for Statistical Computing2024-09-25T15:40:00.4886703Z#30 0.324 Platform: x86_64-pc-linux-gnu (64-bit)2024-09-25T15:40:00.4886967Z#30 0.324 2024-09-25T15:40:00.6008333Z#30 0.333 R is free software and comes with ABSOLUTELY NO WARRANTY.2024-09-25T15:40:00.6008745Z#30 0.333 You are welcome to redistribute it under certain conditions.2024-09-25T15:40:00.6009354Z#30 0.333 Type 'license()' or 'licence()' for distribution details.2024-09-25T15:40:00.6009574Z#30 0.333 2024-09-25T15:40:00.6009812Z#30 0.333 Natural language support but running in an English locale2024-09-25T15:40:00.6027258Z#30 0.333 2024-09-25T15:40:00.6027581Z#30 0.333 R is a collaborative project with many contributors.2024-09-25T15:40:00.6029040Z#30 0.333 Type 'contributors()' for more information and2024-09-25T15:40:00.6029408Z#30 0.333 'citation()' on how to cite R or R packages in publications.2024-09-25T15:40:00.6029638Z#30 0.333 2024-09-25T15:40:00.6030348Z#30 0.333 Type 'demo()' for some demos, 'help()' for on-line help, or2024-09-25T15:40:00.6030698Z#30 0.333 'help.start()' for an HTML browser interface to help.2024-09-25T15:40:00.6031085Z#30 0.333 Type 'q()' to quit R.2024-09-25T15:40:00.6031276Z#30 0.333 2024-09-25T15:40:00.6031578Z#30 0.437 > pak::pkg_install(pkg = '[email protected]')2024-09-25T15:40:02.2917103Z#30 2.127 2024-09-25T15:40:03.2869214Z#30 3.123 ✔ Updated metadata database: 3.40 MB in 9 files.2024-09-25T15:40:03.4391529Z#30 3.124 2024-09-25T15:40:03.4392296Z#30 3.125 ℹ Updating metadata database2024-09-25T15:40:07.4550897Z#30 7.291 ✔ Updating metadata database ... done2024-09-25T15:40:07.4551197Z#30 7.291 2024-09-25T15:40:07.6287043Z#30 7.465 2024-09-25T15:40:07.8371702Z#30 7.471 → Will install 1 package.2024-09-25T15:40:07.8372266Z#30 7.512 → Will download 1 package with unknown size.2024-09-25T15:40:07.8372509Z#30 7.517 + renv 0.15.4 [dl]2024-09-25T15:40:07.8372709Z#30 7.519 2024-09-25T15:40:07.9319230Z#30 7.768 ℹ Getting 1 pkg with unknown size2024-09-25T15:40:08.8747705Z#30 8.711 ✖ Failed to download renv 0.15.4 (x86_64-pc-linux-gnu-ubuntu-20.04)2024-09-25T15:40:11.3361208Z#30 11.17 Error: 2024-09-25T15:40:11.3361635Z#30 11.17 ! error in pak subprocess2024-09-25T15:40:11.3361852Z#30 11.17 Caused by error: 2024-09-25T15:40:11.3362672Z#30 11.17 ! Failed to download renv from `https://packagemanager.posit.co/cran/__linux__/focal/2022-03-09/src/contrib/renv_0.15.4.tar.gz` and `https://packagemanager.posit.co/cran/__linux__/focal/2022-03-09/src/contrib/Archive/renv/renv_0.15.4.tar.gz`.2024-09-25T15:40:11.3363266Z#30 11.17 ---2024-09-25T15:40:11.3363415Z#30 11.17 Backtrace:2024-09-25T15:40:11.3363659Z#30 11.17 1. pak::pkg_install(pkg = "[email protected]")2024-09-25T15:40:11.3364008Z#30 11.17 2. pak:::remote(function(...) get("pkg_install_do_plan", asNamespace("pak"))(...), …2024-09-25T15:40:11.3364274Z#30 11.17 3. err$throw(res$error)2024-09-25T15:40:11.3364471Z#30 11.17 ---2024-09-25T15:40:11.3364667Z#30 11.17 Subprocess backtrace:2024-09-25T15:40:11.3364932Z#30 11.17 1. base::withCallingHandlers(cli_message = function(msg) { …2024-09-25T15:40:11.3365236Z#30 11.17 2. get("pkg_install_do_plan", asNamespace("pak"))(...)2024-09-25T15:40:11.3365482Z#30 11.17 3. proposal$stop_for_download_error()2024-09-25T15:40:11.3365734Z#30 11.17 4. private$plan$stop_for_solution_download_error()2024-09-25T15:40:11.3366022Z#30 11.17 5. pkgdepends:::pkgplan_stop_for_solution_download_error(self, private)2024-09-25T15:40:11.3366286Z#30 11.17 6. pkgdepends:::stop(err)2024-09-25T15:40:11.3366634Z#30 11.17 7. | base::throw(add_class(args[[1]], c("rlib_error_3_0", "rlib_error"), …2024-09-25T15:40:11.3366936Z#30 11.17 8. | base::signalCondition(cond)2024-09-25T15:40:11.3367588Z#30 11.17 9. global (function (e) …2024-09-25T15:40:11.4545311Z#30 11.17 Execution halted2024-09-25T15:40:11.4546165Z#30 ERROR: process "/bin/sh -c R -e \"pak::pkg_install(pkg = '[email protected]')\"" did not complete successfully: exit code: 12024-09-25T15:40:11.4793676Z------2024-09-25T15:40:11.4794177Z> [builder21/38] RUNR-e"pak::pkg_install(pkg = '[email protected]')":2024-09-25T15:40:11.4794553Z11.171.base::withCallingHandlers(cli_message=function(msg) { …
2024-09-25T15:40:11.4794826Z11.172. get("pkg_install_do_plan", asNamespace("pak"))(...)
2024-09-25T15:40:11.4795164Z11.173.proposal$stop_for_download_error()
2024-09-25T15:40:11.4795417Z11.174.private$plan$stop_for_solution_download_error()
2024-09-25T15:40:11.4795855Z11.175.pkgdepends:::pkgplan_stop_for_solution_download_error(self, private)
2024-09-25T15:40:11.4796128Z11.176.pkgdepends:::stop(err)
2024-09-25T15:40:11.4796393Z11.177.|base::throw(add_class(args[[1]], c("rlib_error_3_0", "rlib_error"), …
2024-09-25T15:40:11.4797040Z11.178.|base::signalCondition(cond)
2024-09-25T15:40:11.4797339Z11.179. global (function (e) …
2024-09-25T15:40:11.4797562Z11.17Executionhalted2024-09-25T15:40:11.4797795Z------2024-09-25T15:40:11.4818128Z2024-09-25T15:40:11.4819050Z �[33m4warnings found (usedocker--debugtoexpand):2024-09-25T15:40:11.4819563Z �[0m-WorkdirRelativePath:Relativeworkdir"Python-3.10.9"canhaveunexpectedresultsifthebaseimage changes (line45)
2024-09-25T15:40:11.4820049Z-LegacyKeyValueFormat:"ENV key=value"shouldbeusedinsteadoflegacy"ENV key value" format (line87)
2024-09-25T15:40:11.4820934Z-LegacyKeyValueFormat:"ENV key=value"shouldbeusedinsteadoflegacy"ENV key value" format (line98)
2024-09-25T15:40:11.4826757Z-JSONArgsRecommended:JSONargumentsrecommendedforCMDtopreventunintendedbehaviorrelatedtoOS signals (line112)
2024-09-25T15:40:11.4827087ZDockerfile:762024-09-25T15:40:11.4827329Z--------------------2024-09-25T15:40:11.4827557Z74|2024-09-25T15:40:11.4827839Z75|# Install `renv` and `reticulate`.2024-09-25T15:40:11.4828159Z76|>>>RUNR-e"pak::pkg_install(pkg = '[email protected]')"2024-09-25T15:40:11.4828503Z77|RUNR-e"pak::pkg_install(pkg = '[email protected]')"2024-09-25T15:40:11.4828741Z78|2024-09-25T15:40:11.4829066Z--------------------2024-09-25T15:40:11.4829522ZERROR:failedtosolve:process"/bin/sh -c R -e \"pak::pkg_install(pkg = '[email protected]')\""didnotcompletesuccessfully:exitcode:1
The text was updated successfully, but these errors were encountered:
This problem was due to my own user error. Following a different tip from the same section resulted in a successful build, as pak was able to source the packages from https://cloud.r-project.org.
# Install `pak`# Switch the default CRAN mirror# https://rocker-project.org/images/versioned/r-ver.html#switch-the-default-cran-mirrorRUN /rocker_scripts/setup_R.sh https://cloud.r-project.org
RUN R -e "install.packages('https://cloud.r-project.org/src/contrib/Archive/pak/pak_0.7.2.tar.gz')"# Install `renv` and `reticulate`.RUN R -e "pak::pkg_install(pkg = '[email protected]')"
I have a Quarto website I have built and want to host after it has been containerized in Docker. I can build the Docker image locally, but I am having issues trying to build it using an Azure DevOps Pipeline. The issue seems to stem from when I try to install specific versions of packages I want using
pak
.The overview of the Dockerfile's steps:
r-ver
image to build the website.pak
with hard-coded URL.renv
version0.15.5
.The
pak::pkg_install(pkg = '[email protected]')
install returns an error that I cannot understand why it is happening. My interpretation is that it downloadsrenv
version0.15.4
instead of0.15.5
that I specified. I believe it may have to do with the fact that myoptions()
call is not being carried forward when I callpak
, as I seepak
says itFailed to download renv from 'https://packagemanager.posit.co/cran/__linux__/focal/2022-03-09/src/contrib/renv_0.15.4.tar.gz' and 'https://packagemanager.posit.co/cran/__linux__/focal/2022-03-09/src/contrib/Archive/renv/renv_0.15.4.tar.gz'.
The text was updated successfully, but these errors were encountered: