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

RSPM archived package (rgdal) cannot be resolved #1110

Closed
aronatkins opened this issue Oct 24, 2024 · 0 comments · Fixed by #1111
Closed

RSPM archived package (rgdal) cannot be resolved #1110

aronatkins opened this issue Oct 24, 2024 · 0 comments · Fixed by #1111
Assignees

Comments

@aronatkins
Copy link
Contributor

Given the following Dockerfile:

FROM rstudio/r-base:4.0-jammy

RUN export DEBIAN_FRONTEND=noninteractive \
    && apt-get update \
    && apt-get install -y \
    curl \
    libcurl4-openssl-dev \
    libgdal-dev \
    && rm -rf /var/lib/apt/lists/*

ARG REPO=https://cran.rstudio.com
# ARG REPO=https://p3m.dev/cran/__linux__/jammy/latest
RUN R -e "install.packages('shiny', repos=c(CRAN='${REPO}')); library(shiny)"

RUN R -e "install.packages('remotes', repos=c(CRAN='${REPO}')); library(remotes)"
RUN R -e "remotes::install_version('rgdal','1.6-7', repos=c(CRAN='${REPO}')); library(rgdal)"

RUN R -e "install.packages('rsconnect', repos=c(CRAN='${REPO}')); library(rsconnect)"

COPY app.R /content/app.R

WORKDIR /content

RUN R -e "options(repos=c(CRAN='${REPO}/',RSPM='${REPO}')); rsconnect::appDependencies()" > dependencies.txt
RUN R -e "options(repos=c(CRAN='${REPO}/',RSPM='${REPO}')); rsconnect::writeManifest()"

and a very simple app.R:

library(shiny)
library(rgdal)

ui <- fluidPage("hello")
server <- function(input, output) {}

shinyApp(ui = ui, server = server)

Dependencies can be resolved from CRAN, but not from RSPM.

# succeeds
docker build -t shiny-rgdal .

# fails
docker build --build-arg REPO=https://p3m.dev/cran/__linux__/jammy/latest -t shiny-rgdal-p3m .

The error message:

0.519 > options(repos=c(CRAN='https://p3m.dev/cran/__linux__/jammy/latest/',RSPM='https://p3m.dev/cran/__linux__/jammy/latest')); rsconnect::writeManifest()
0.647 ℹ Capturing R dependencies with renv
11.65 ✔ Found 33 dependencies
11.75 Error in `createAppManifest()`:
11.75 ! All packages must be installed from a reproducible location.
11.75 ✖ Can't re-install packages installed from source: rgdal.
11.75 ℹ See `rsconnect::appDependencies()` for more details.
11.75 Backtrace:
11.75     ▆
11.75  1. └─rsconnect::writeManifest()
11.75  2.   └─rsconnect:::createAppManifest(...)
11.75  3.     └─rsconnect:::bundlePackages(...)
11.75  4.       └─rsconnect:::checkBundlePackages(deps, call = error_call)
11.75  5.         └─cli::cli_abort(...)
11.75  6.           └─rlang::abort(...)
11.76 Execution halted

This is caused by an inability to associate the rgdal package to a repository.

if (pkg$Source == "Repository") {
if (identical(pkg$Repository, "CRAN")) {
if (isDevVersion(pkg, availablePackages)) {
pkg$Source <- NA_character_
pkg$Repository <- NA_character_
} else {
pkg$Source <- "CRAN"
pkg$Repository <- findRepoUrl(pkg$Package, availablePackages)
}
} else {
# $Repository comes from DESCRIPTION and is set by repo, so can be
# anything. So we must look up from the package name
pkg$Repository <- findRepoUrl(pkg$Package, availablePackages)
pkg$Source <- findRepoName(pkg$Repository, repos)
}

This code handles "CRAN" differently from "RSPM". The calls to findRepoUrl() and findRepoName() both produce NA.

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

Successfully merging a pull request may close this issue.

1 participant