Failing to publish/deploy a shiny app to an Posit Connect because of Bioconductor

I have a shiny app the I've been publishing to a Posit Connect server hosted by the HPC at my institution. The app is from my RStudio on my laptop . The Cluster has configured Posit Connect to use Package Manager to host and vet packages for security and stability. Up until recently, one of the apps I was making changes to stopped publishing normally, reverting the code does nothing. The error log is as follows:

Preparing to deploy application...DONE
Uploading bundle for application: 194...Warning: 
* May be unable to deploy package dependency 'Biobase'; could not
  determine a repository URL for the source 'Bioconductor'.

* May be unable to deploy package dependency 'BiocGenerics'; could not
  determine a repository URL for the source 'Bioconductor'.

* May be unable to deploy package dependency 'ComplexHeatmap'; could
  not determine a repository URL for the source 'Bioconductor'.

* May be unable to deploy package dependency 'DelayedArray'; could not
  determine a repository URL for the source 'Bioconductor'.

* May be unable to deploy package dependency 'GenomeInfoDb'; could not
  determine a repository URL for the source 'Bioconductor'.

* May be unable to deploy package dependency 'GenomeInfoDbData'; could
  not determine a repository URL for the source 'Bioconductor'.

* May be unable to deploy package dependency 'GenomicRanges'; could not
  determine a repository URL for the source 'Bioconductor'.

* May be unable to deploy package dependency 'IRanges'; could not
  deter [... truncated]
DONE
Deploying bundle: 2412 for application: 194 ...
[Connect] Building Shiny application...
[Connect] Bundle created with R version 4.3.1 is compatible with environment Local with R version 4.2.1 from /opt/R/4.2.1/bin/R 
[Connect] Bundle requested R version 4.3.1; using /opt/R/4.2.1/bin/R which has version 4.2.1
[Connect] 2023/06/28 00:36:47.438607069 [rsc-session] Content GUID: 3b5a96d1-ff2b-43c1-a358-31ab157ed34e
[Connect] 2023/06/28 00:36:47.440151493 [rsc-session] Content ID: 194
[Connect] 2023/06/28 00:36:47.440182650 [rsc-session] Bundle ID: 2412
[Connect] 2023/06/28 00:36:48.472774418 Running on host: ccb-rstudio-frontend02.rc.hms.harvard.edu
[Connect] 2023/06/28 00:36:48.488884749 Linux distribution: CentOS Linux release 7.9.2009 (Core)
[Connect] 2023/06/28 00:36:48.497343573 Running as user: uid=1204(rstudio-connect) gid=1204(rstudio-connect) groups=1204(rstudio-connect)
[Connect] 2023/06/28 00:36:48.497355956 Connect version: 2023.03.0
[Connect] 2023/06/28 00:36:48.497412673 LANG: en_US.UTF-8
[Connect] 2023/06/28 00:36:48.497414316 Working directory: /opt/rstudio-connect/mnt/app
[Connect] 2023/06/28 00:36:48.498098051 Using R 4.2.1
[Connect] 2023/06/28 00:36:48.498116873 R.home(): /opt/R/4.2.1/lib/R
[Connect] 2023/06/28 00:36:48.499915918 Using user agent string: 'RStudio R (4.2.1 x86_64-pc-linux-gnu x86_64 linux-gnu)' 
[Connect] 2023/06/28 00:36:48.500576402 # Validating R library read / write permissions --------------------------------
[Connect] 2023/06/28 00:36:48.504334334 Using R library for packrat bootstrap: /opt/rstudio-connect/mnt/R/4.2.1
[Connect] 2023/06/28 00:36:48.504583023 # Validating managed packrat installation --------------------------------------
[Connect] 2023/06/28 00:36:48.505160063 Vendored packrat archive: /opt/rstudio-connect/ext/R/packrat_0.9.1_91ea7f537fb69ce5706114dd8f949fa5b0820efc.tar.gz
[Connect] 2023/06/28 00:36:48.528306549 Vendored packrat SHA: 91ea7f537fb69ce5706114dd8f949fa5b0820efc
[Connect] 2023/06/28 00:36:48.533583454 Managed packrat SHA:  91ea7f537fb69ce5706114dd8f949fa5b0820efc
[Connect] 2023/06/28 00:36:48.536242218 Managed packrat version: 0.9.1
[Connect] 2023/06/28 00:36:48.536667803 Managed packrat is up-to-date.
[Connect] 2023/06/28 00:36:48.537034021 # Validating packrat cache read / write permissions ----------------------------
[Connect] 2023/06/28 00:36:48.635833532 Using packrat cache directory: /opt/rstudio-connect/mnt/packrat/4.2.1
[Connect] 2023/06/28 00:36:49.219188276 Audited package hashes with local packrat installation.
[Connect] 2023/06/28 00:36:49.328694414 # Installing required R packages with `packrat::restore()` ---------------------
[Connect] 2023/06/28 00:36:50.271434139 Installing BH (1.81.0-1) ... 
[Connect] 2023/06/28 00:36:50.298759034 Using cached BH.
[Connect] 2023/06/28 00:36:50.299953779 	OK (symlinked cache)
[Connect] 2023/06/28 00:36:50.300100268 Installing BiocGenerics (0.46.0) ... 
[Connect] 2023/06/28 00:36:50.527819921 curl: HTTP 200 https://cran.rstudio.com/src/contrib/PACKAGES.rds
[Connect] 2023/06/28 00:36:51.173521703 curl: HTTP 200 https://rspm.connect.hms.harvard.edu/prod-cran/latest/src/contrib/PACKAGES.rds
[Connect] 2023/06/28 00:37:17.983907982 curl: HTTP 404 https://cran.rstudio.com//src/contrib/Archive/BiocGenerics/BiocGenerics_0.46.0.tar.gz
[Connect] 2023/06/28 00:37:17.983947885 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/28 00:37:19.171784524 curl: HTTP 404 https://cran.rstudio.com//src/contrib/Archive/BiocGenerics/BiocGenerics_0.46.0.tar.gz
[Connect] 2023/06/28 00:37:19.171795205 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/28 00:37:20.407475180 curl: HTTP 404 https://cran.rstudio.com//src/contrib/Archive/BiocGenerics/BiocGenerics_0.46.0.tar.gz
[Connect] 2023/06/28 00:37:20.407486316 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/28 00:37:21.640974163 curl: HTTP 404 https://cran.rstudio.com//src/contrib/Archive/BiocGenerics/BiocGenerics_0.46.0.tar.gz
[Connect] 2023/06/28 00:37:21.640990590 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/28 00:37:22.824404103 curl: HTTP 404 https://cran.rstudio.com//src/contrib/Archive/BiocGenerics/BiocGenerics_0.46.0.tar.gz
[Connect] 2023/06/28 00:37:22.824414553 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/28 00:37:24.218334948 curl: HTTP 404 https://rspm.connect.hms.harvard.edu/prod-cran/latest/src/contrib/Archive/BiocGenerics/BiocGenerics_0.46.0.tar.gz
[Connect] 2023/06/28 00:37:24.218345466 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/28 00:37:25.615125315 curl: HTTP 404 https://rspm.connect.hms.harvard.edu/prod-cran/latest/src/contrib/Archive/BiocGenerics/BiocGenerics_0.46.0.tar.gz
[Connect] 2023/06/28 00:37:25.615139854 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/28 00:37:27.011911186 curl: HTTP 404 https://rspm.connect.hms.harvard.edu/prod-cran/latest/src/contrib/Archive/BiocGenerics/BiocGenerics_0.46.0.tar.gz
[Connect] 2023/06/28 00:37:27.011924177 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/28 00:37:28.417026399 curl: HTTP 404 https://rspm.connect.hms.harvard.edu/prod-cran/latest/src/contrib/Archive/BiocGenerics/BiocGenerics_0.46.0.tar.gz
[Connect] 2023/06/28 00:37:28.417045254 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/28 00:37:29.811606476 curl: HTTP 404 https://rspm.connect.hms.harvard.edu/prod-cran/latest/src/contrib/Archive/BiocGenerics/BiocGenerics_0.46.0.tar.gz
[Connect] 2023/06/28 00:37:29.811619482 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/28 00:37:30.814883774 FAILED
[Connect] 2023/06/28 00:37:30.816503361 Error in getSourceForPkgRecord(pkgRecord, srcDir(project), availablePackagesSource(repos = repos), : Failed to retrieve package sources for BiocGenerics 0.46.0 from CRAN (internet connectivity issue?)
[Connect] 2023/06/28 00:37:30.816546249 
[Connect] 2023/06/28 00:37:30.816548415 Unable to fully restore the R packages associated with this deployment.
[Connect] 2023/06/28 00:37:30.816571194 Please review the preceding messages to determine which package
[Connect] 2023/06/28 00:37:30.816572328 encountered installation difficulty and the cause of the failure.
[Connect] 2023/06/28 00:37:30.828662048 Warning message:
[Connect] 2023/06/28 00:37:30.828781362 In packrat::restore(overwrite.dirty = TRUE, prompt = FALSE, restart = FALSE) :
[Connect] 2023/06/28 00:37:30.828787682   The most recent snapshot was generated using R version 4.3.1
[Connect] An error occurred while building your content.
[Connect] This link offers advice for this kind of error:
[Connect]     https://docs.posit.co/connect/user/troubleshooting/#r-package-not-available
[Connect] Build error: An error occurred while building your content. (Error code: r-package-not-available)
Application deployment failed with error: An error occurred while building your content. (Error code: r-package-not-available)

My .Rprofile file :

options(repos = c(CRAN = "https://rspm.connect.hms.harvard.edu/prod-cran/latest"))
options(BioC_mirror = "https://rspm.connect.hms.harvard.edu/bioconductor")
options(repos = BiocManager::repositories())

One of the packages shows up like this in the manifest.json

"Biobase": {
      "Source": "RSPM",
      "Repository": null,
      "description": {
        "Package": "Biobase",
        "Title": "Biobase: Base functions for Bioconductor",
        "Description": "Functions that are needed by many other packages or which\n        replace R functions.",
        "biocViews": "Infrastructure",
        "URL": "https://bioconductor.org/packages/Biobase",
        "BugReports": "https://github.com/Bioconductor/Biobase/issues",
        "Version": "2.60.0",
        "License": "Artistic-2.0",
        "Authors@R": "c(\n    person(\"R.\", \"Gentleman\", role=\"aut\"),\n    person(\"V.\", \"Carey\", role = \"aut\"),\n    person(\"M.\", \"Morgan\", role=\"aut\"),\n    person(\"S.\", \"Falcon\", role=\"aut\"),\n    person(\"Haleema\", \"Khan\",\n        role = \"ctb\",\n        comment = \"'esApply' and 'BiobaseDevelopment' vignette translation from Sweave to Rmarkdown / HTML\"\n    ),\n    person(\"Bioconductor Package Maintainer\",\n        role = \"cre\",\n        email = \"maintainer@bioconductor.org\"\n    ))",
        "Suggests": "tools, tkWidgets, ALL, RUnit, golubEsets, BiocStyle, knitr",
        "Depends": "R (>= 2.10), BiocGenerics (>= 0.27.1), utils",
        "Imports": "methods",
        "VignetteBuilder": "knitr",
        "LazyLoad": "yes",
        "Collate": "tools.R strings.R environment.R vignettes.R packages.R\nAllGenerics.R VersionsClass.R VersionedClasses.R\nmethods-VersionsNull.R methods-VersionedClass.R DataClasses.R\nmethods-aggregator.R methods-container.R methods-MIAxE.R\nmethods-MIAME.R methods-AssayData.R\nmethods-AnnotatedDataFrame.R methods-eSet.R\nmethods-ExpressionSet.R methods-MultiSet.R methods-SnpSet.R\nmethods-NChannelSet.R anyMissing.R rowOp-methods.R\nupdateObjectTo.R methods-ScalarObject.R zzz.R",
        "git_url": "https://git.bioconductor.org/packages/Biobase",
        "git_branch": "RELEASE_3_17",
        "git_last_commit": "8dc10d2",
        "git_last_commit_date": "2023-04-25",
        "Date/Publication": "2023-04-25",
        "NeedsCompilation": "yes",
        "Packaged": "2023-04-25 20:18:46 UTC; biocbuild",
        "Author": "R. Gentleman [aut],\n  V. Carey [aut],\n  M. Morgan [aut],\n  S. Falcon [aut],\n  Haleema Khan [ctb] ('esApply' and 'BiobaseDevelopment' vignette\n    translation from Sweave to Rmarkdown / HTML),\n  Bioconductor Package Maintainer [cre]",
        "Maintainer": "Bioconductor Package Maintainer <maintainer@bioconductor.org>",
        "Repository": "RSPM",
        "Encoding": "UTF-8",
        "Built": "R 4.3.1; x86_64-w64-mingw32; 2023-06-27 21:30:42 UTC; windows",
        "Archs": "x64"
      }

Which I thought should have taken care of the bioconductor packages. Why is the manifest trying to pull from CRAN instead of bioconductor? Is it supposed to have the repo listed as RSPM or as bioconductor? I've also tried clearing the library, doing a fresh reinstall of R and all the packages using the public mirrors, but still encounter this error. Was able to also replicate this error on another machine. Is there something I should ask the admins of Package Manager and Posit Connect to troubleshoot?

Hello there.

I am sorry to hear about your trouble.

Your approach in general is very much in line with what we recommend at Solutions - BioConductor

And in general, During an app deployment, Connect will look up each requested package and version (part of the manifest.json in the application bundle and try to find it on each of the listed repositories until it hits the right one. By not only using package name and version but also some checksums there is a guarantee it will find and use the correct package.

In your case Connect looks into two repositories (https://cran.rstudio.com/ and https://rspm.connect.hms.harvard.edu/prod-cran/) but for some reason it cannot find any reference to Bioconductor repos.

I would be curious what options()$repos reports on your local laptop. Can you please copy&paste here ?

Using those settings, can you install the package BiocGenerics sucessfully on your laptop ?

Did you recently upgrade your R version on your local laptop ? Did this upgrade correspond to the publishing errors ? I notice that you are using R 4.3.1 locally but connect only offers R 4.2.1 that it marks as "compatible" - with Bioconductor however you always have a unique mapping between Bioconductor release an R version which means that Bioconductor 3.17 that you are using on your laptop is compatible with R 4.3.1 but definitely not with R 4.2.1 (which is compatible with Bioconductor 3.15 and 3.16).

Hi, this is the output from Console:

> options()$repos
                                                   CRAN 
                            "https://cran.rstudio.com/" 
                                                hmsrspm 
"https://rspm.connect.hms.harvard.edu/prod-cran/latest" 
attr(,"RStudio")
[1] TRUE

I've also managed to brute force some of the packages with the options using the full path, because the deployment doesn't seem to know how to navigate the bioconductor RSPM repo.

options(repos = c(BioC_mirror = "https://rspm.connect.hms.harvard.edu/bioconductor/packages/3.17/bioc/",CRAN = "https://rspm.connect.hms.harvard.edu/prod-cran/latest", ))

This doesn't work for Packages in alternate annotation paths such as GenomeInfoDbData

[Connect] 2023/06/30 19:03:28.385758088 curl: HTTP 200 https://rspm.connect.hms.harvard.edu/bioconductor/packages/3.17/bioc/src/contrib/PACKAGES.rds
[Connect] 2023/06/30 19:03:28.445218071 curl: HTTP 200 https://rspm.connect.hms.harvard.edu/prod-cran/latest/src/contrib/PACKAGES.rds
[Connect] 2023/06/30 19:03:28.846780911 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/30 19:03:28.846794670 curl: HTTP 404 https://rspm.connect.hms.harvard.edu/bioconductor/packages/3.17/bioc/src/contrib/Archive/GenomeInfoDbData/GenomeInfoDbData_1.2.10.tar.gz
[Connect] 2023/06/30 19:03:29.900060380 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/30 19:03:29.900071263 curl: HTTP 404 https://rspm.connect.hms.harvard.edu/bioconductor/packages/3.17/bioc/src/contrib/Archive/GenomeInfoDbData/GenomeInfoDbData_1.2.10.tar.gz
[Connect] 2023/06/30 19:03:30.943333553 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/30 19:03:30.943345285 curl: HTTP 404 https://rspm.connect.hms.harvard.edu/bioconductor/packages/3.17/bioc/src/contrib/Archive/GenomeInfoDbData/GenomeInfoDbData_1.2.10.tar.gz
[Connect] 2023/06/30 19:03:31.981558812 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/30 19:03:31.981570948 curl: HTTP 404 https://rspm.connect.hms.harvard.edu/bioconductor/packages/3.17/bioc/src/contrib/Archive/GenomeInfoDbData/GenomeInfoDbData_1.2.10.tar.gz
[Connect] 2023/06/30 19:03:33.022740759 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/30 19:03:33.022751826 curl: HTTP 404 https://rspm.connect.hms.harvard.edu/bioconductor/packages/3.17/bioc/src/contrib/Archive/GenomeInfoDbData/GenomeInfoDbData_1.2.10.tar.gz
[Connect] 2023/06/30 19:03:34.208159953 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/30 19:03:34.208173769 curl: HTTP 404 https://rspm.connect.hms.harvard.edu/prod-cran/latest/src/contrib/Archive/GenomeInfoDbData/GenomeInfoDbData_1.2.10.tar.gz
[Connect] 2023/06/30 19:03:35.394108646 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/30 19:03:35.394119593 curl: HTTP 404 https://rspm.connect.hms.harvard.edu/prod-cran/latest/src/contrib/Archive/GenomeInfoDbData/GenomeInfoDbData_1.2.10.tar.gz
[Connect] 2023/06/30 19:03:36.579445948 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/30 19:03:36.579459828 curl: HTTP 404 https://rspm.connect.hms.harvard.edu/prod-cran/latest/src/contrib/Archive/GenomeInfoDbData/GenomeInfoDbData_1.2.10.tar.gz
[Connect] 2023/06/30 19:03:37.764646632 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/30 19:03:37.764658339 curl: HTTP 404 https://rspm.connect.hms.harvard.edu/prod-cran/latest/src/contrib/Archive/GenomeInfoDbData/GenomeInfoDbData_1.2.10.tar.gz
[Connect] 2023/06/30 19:03:38.956389797 curl: (22) The requested URL returned error: 404 Not Found
[Connect] 2023/06/30 19:03:38.956420644 curl: HTTP 404 https://rspm.connect.hms.harvard.edu/prod-cran/latest/src/contrib/Archive/GenomeInfoDbData/GenomeInfoDbData_1.2.10.tar.gz
[Connect] 2023/06/30 19:03:39.957765844 FAILED
[Connect] 2023/06/30 19:03:39.958939184 Error in getSourceForPkgRecord(pkgRecord, srcDir(project), availablePackagesSource(repos = repos), : Failed to retrieve package sources for GenomeInfoDbData 1.2.10 from CRAN (internet connectivity issue?)
[Connect] 2023/06/30 19:03:39.958963401 
[Connect] 2023/06/30 19:03:39.958999596 Unable to fully restore the R packages associated with this deployment.
[Connect] 2023/06/30 19:03:39.959001201 Please review the preceding messages to determine which package
[Connect] 2023/06/30 19:03:39.959015872 encountered installation difficulty and the cause of the failure.
[Connect] An error occurred while building your content.
[Connect] This link offers advice for this kind of error:
[Connect]     https://docs.posit.co/connect/user/troubleshooting/#r-package-not-available
[Connect] Build error: An error occurred while building your content. (Error code: r-package-not-available)

Thanks for providing all of this details.

You seem to be mixing BioC_mirror into the repository options. You may want to keep things separate and run

options(BioC_mirror = "rspm.connect.hms.harvard.edu/bioconductor/")
options(repos=c(CRAN = "https://rspm.connect.hms.harvard.edu/prod-cran/latest"))
options(repos=BiocManager::repositories())

This will effectively set up your repositories to use both your internal Package manager for CRAN as well as for Bioconductor - please note you do NOT need to set the version number of the Bioconductor release - BiocManager::repositories() will figure that out for you. If you would like to ensure to always get the same Bioconductor release, add the version as argument to the BiocManager::repositories() call (e.g. version="3.17").

Using the above approach I am fairly confodent that your deployment to Connect will work. I'd suggest to put the lines above in a .Rprofile within the project folder where you develop your app so that those settings are picked up automatically no matter if you use push-button or CLI deployment to Connect.

In case you still experience any issue, please do not hesitate to get back to us.