'Trying to use "pak" to install an R source library from a private CRAN-like repo

I'm trying to use "pak" to install an R source library from a private CRAN repo (hosted with Artifactory) and I haven't been able to figure out how to get it to work. I start with a conda enviroment like so:

conda create --name testing_r_pak --channel=conda-forge r-base=4.1.0 r-essentials=4.1.0
conda activate testing_r_pak
Rscript -e 'install.packages("pak", repos = "http://cran.us.r-project.org")'

and then run the following to try and install my R package, along with deliver some troubleshooting info:

Rscript -e 'options(width=400); print(pak::repo_status()); pak::pkg_install("TestRPackage")'

Here's the result:

# A data frame: 6 × 10
  name          url                                                         type     bioc_version platform path        r_version ok     ping error 
  <chr>         <chr>                                                       <chr>    <chr>        <chr>    <chr>       <chr>     <lgl> <dbl> <list>
1 pvt_cran      https://<pvt_cran_repo_url>/                                cranlike NA           source   src/contrib 4.1       TRUE   1.05 <NULL>
2 CRAN          https://cran.rstudio.com                                    cran     NA           source   src/contrib 4.1       TRUE   1.05 <NULL>
3 BioCsoft      https://bioconductor.org/packages/3.14/bioc                 bioc     3.14         source   src/contrib 4.1       TRUE   1.05 <NULL>
4 BioCann       https://bioconductor.org/packages/3.14/data/annotation      bioc     3.14         source   src/contrib 4.1       TRUE   1.06 <NULL>
5 BioCexp       https://bioconductor.org/packages/3.14/data/experiment      bioc     3.14         source   src/contrib 4.1       TRUE   1.23 <NULL>
6 BioCworkflows https://bioconductor.org/packages/3.14/workflows            bioc     3.14         source   src/contrib 4.1       TRUE   1.25 <NULL>
✔ Loading metadata database ... done

Error: <callr_remote_error: Cannot install packages:
* TestRPackage: Can't find package called TestRPackage.>
 in process 21027 
-->
<simpleError: Cannot install packages:
* TestRPackage: Can't find package called TestRPackage.>

 Stack trace:

 12. (function (...)  ...
 13. base:::withCallingHandlers(cli_message = function(msg) { ...
 14. get("pkg_install_make_plan", asNamespace("pak"))(...)
 15. prop$stop_for_solution_error()
 16. private$plan$stop_for_solve_error()
 17. pkgdepends:::pkgplan_stop_for_solve_error(self, private)
 18. base:::stop("Cannot install packages:\n", msg, call. = FALSE)
 19. base:::.handleSimpleError(function (e)  ...
 20. h(simpleError(msg, call))
 21. base:::stop(e)
 22. (function (e)  ...

 x Cannot install packages:
* TestRPackage: Can't find package called TestRPackage. 

Execution halted

Some notes:

  • I know I have a correctly constructed .Rprofile with my private CRAN repo added into it. As you can see, pak::repo_status() even sees it correctly.
  • I know I have a properly functioning private CRAN repo because running Rscript -e 'install.packages("TestRPackage", repos = "https://<pvt_cran_repo_url>")' in the same conda environment works fine.
  • I've tried a few different versions of R with the same result.
  • I've tried this on a couple of different hosts (Mac, Ubuntu) with the same result.
  • I've also tried this without conda, with the same result.

I'm pretty stumped here - I hope it's something obvious I'm missing, but I'm not sure what else to do. I'd appreciate any help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source