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

{pak} cannot resolve dependencies with public PM as single repo #574

Open
pat-s opened this issue Dec 15, 2023 · 6 comments
Open

{pak} cannot resolve dependencies with public PM as single repo #574

pat-s opened this issue Dec 15, 2023 · 6 comments

Comments

@pat-s
Copy link

pat-s commented Dec 15, 2023

(Applies to any package, brew is just an example)

getOption("repos")
                                                             CRAN 
"https://packagemanager.posit.co/cran/__linux__/rhel9/2023-10-31" 

pak::pkg_install("brew")
Error: 
! error in pak subprocess
Caused by error: 
! Could not solve package dependencies:
* brew: Can't find package called brew.

---
Backtrace:
1. pak::pkg_install("brew")
2. pak:::remote(function(...) get("pkg_install_make_plan", asNamespace("pak"))(...), …
3. err$throw(res$error)
---
Subprocess backtrace:
1. base::withCallingHandlers(cli_message = function(msg) { …
2. get("pkg_install_make_plan", asNamespace("pak"))(...)
3. prop$stop_for_solution_error()
4. private$plan$stop_for_solve_error()
5. pkgdepends:::pkgplan_stop_for_solve_error(self, private)
6. base::throw(new_error("Could not solve package dependencies:\n", msg, …
7. | base::signalCondition(cond)
8. global (function (e) …

install.packages() works just fine:

getOption("repos")
                                                             CRAN 
"https://packagemanager.posit.co/cran/__linux__/rhel9/2023-10-31" 

install.packages("brew")
Installing package into/home/x60039989/R/x86_64-pc-linux-gnu-library/4.3’
(aslibis unspecified)
trying URL 'https://packagemanager.posit.co/cran/__linux__/rhel9/2023-10-31/src/contrib/brew_1.0-8.tar.gz'
Content type 'binary/octet-stream' length 80367 bytes (78 KB)
==================================================
downloaded 78 KB

* installing *binary* packagebrew...
* DONE (brew)

pak 0.7.1

@gaborcsardi
Copy link
Member

What is the output of pak::system_r_platform()?

@pat-s
Copy link
Author

pat-s commented Dec 18, 2023

> pak::system_r_platform()
[1] "x86_64-pc-linux-gnu-rhel-9.3"

@gaborcsardi
Copy link
Member

Hmmm, I cannot reproduce that:

> options(repos = c(CRAN = "https://packagemanager.posit.co/cran/__linux__/rhel9/2023-10-31"))
> pak::pkg_install("brew?reinstall&nocache")
✔ Updated metadata database: 4.64 MB in 8 files.
✔ Updating metadata database ... done

→ Will install 1 package.
→ Will download 1 package with unknown size.
+ brew   1.0-8 [dl]
ℹ Getting 1 pkg with unknown size
✔ Got brew 1.0-8 (x86_64-pc-linux-gnu-rhel-9.2) (80.37 kB)
✔ Downloaded 1 package (80.37 kB) in 1.1s
✔ Installed brew 1.0-8  (1.1s)
✔ 1 pkg: added 1, dld 1 (80.37 kB) [9s]
> pak::system_r_platform()
[1] "x86_64-pc-linux-gnu-rhel-9.2"
> pak::pak_sitrep()
* pak version:
- 0.7.1
* Version information:
- pak platform: x86_64-pc-linux-musl (current: x86_64-pc-linux-gnu, compatible)
...

@pat-s
Copy link
Author

pat-s commented May 14, 2024

I've tracked it down and it seems to be caused by

https://github.com/r-lib/pkgcache/blob/48c1017bbe75534a514ce226febb97687aaeee78/R/metadata-cache.R#L416C17-L416C31

which does not work in a secured environment which only has whitelistings for packagemanager.posit.co, cran.r-project.org and rspm-sync.rstudio.com.

@gaborcsardi
Copy link
Member

So what happens if you do this?

curl::curl_fetch_memory("https://cran.r-pkg.org/metadata/src/contrib/METADATA2.gz")

@pat-s
Copy link
Author

pat-s commented May 14, 2024

curl::curl_fetch_memory("https://cran.r-pkg.org/metadata/src/contrib/METADATA2.gz")
$url
[1] "https://cran.r-pkg.org/metadata/src/contrib/METADATA2.gz"

$status_code
[1] 403

$type
[1] "text/html"

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

No branches or pull requests

2 participants