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

Operator invalid for atomic vectors, r$version #474

Closed
jonlachmann opened this issue Mar 28, 2023 · 13 comments
Closed

Operator invalid for atomic vectors, r$version #474

jonlachmann opened this issue Mar 28, 2023 · 13 comments

Comments

@jonlachmann
Copy link

Hi!

I have been using pak on the devel version as I am otherwise experiencing issues with packages that I some of the time want to download from github, and some of the time from CRAN (i.e. to get the latest version, but then go back to CRAN). Yesterday the latest pak devel version worked great, but today I get the error below. It seems to be related to the ppm adjustments made.

To solve this in the meantime, I wonder:

Is there a new stable version of pak planned for release to CRAN? At the moment the issues I am having with packages that are sometimes on CRAN and sometimes on github makes the current CRAN version problematic to use.

Is it possible to get yesterdays devel build somehow?

✔ Loading metadata database ... done
Error: 
! error in pak subprocess
Caused by error in `r$version`:
! $ operator is invalid for atomic vectors
---
Backtrace:
1. pak::local_install(".", ask = F, upgrade = F)
2. pak:::remote(function(...) get("local_install_make_plan", asNamespace("pak"))(...), …
3. err$throw(res$error)
---
Subprocess backtrace:
 1. base::withCallingHandlers(cli_message = function(msg) { …
 2. get("local_install_make_plan", asNamespace("pak"))(...)
 3. pak:::pkg_install_make_plan(pkg, lib, upgrade, ask, start, dependencies, …
 4. prop$solve()
 5. private$plan$solve(policy = private$policy)
 6. pkgdepends:::pkgplan_solve(self, private, match.arg(policy))
 7. private$create_lp_problem(pkgs, policy)
 8. pkgdepends:::pkgplan__create_lp_problem(self, private, pkgs, policy)
 9. pkgdepends:::pkgplan_i_create_lp_problem(pkgs, private$config, policy)
10. pkgdepends:::pkgplan_i_lp_latest_direct(lp)
11. pkgdepends:::vlapply(lp$pkgs$remote, function(r) !is.null(r$version) && r$version != …
12. base::vapply(X, FUN, FUN.VALUE = logical(1), ...)
13. local FUN(X[[i]], ...)
14. base::.handleSimpleError(function (e) …
15. global h(simpleError(msg, call))
Execution halted
@gaborcsardi
Copy link
Member

gaborcsardi commented Mar 28, 2023

Can you show a reproducible example? E.g. is the package you are experiencing this with public?

@jonlachmann
Copy link
Author

Can you show a reproducible example? E.g. is the package you are experiencing this with public?

Hi! The problem is that the package this is occurring with is proprietary... I can try to debug it to see if I can get more information, to see if it is possible to build a minimal reproducible example.

Is it possible to access older versions of the devel prebuilts?

@gaborcsardi
Copy link
Member

Is it possible to access older versions of the devel prebuilts?

Yes, with a bit of work. Go to https://github.com/r-lib/pak/blob/a5c1a8408ca93f8ef757b1aca5dd5fca14cb0fba/manifest.json (this is yesterday's version) and look for the sha of the R platform and R version you need. Once you have the sha you can download the package like this, with command line curl:

curl -L -H "Authorization: Bearer QQ==" https://ghcr.io/v2/r-lib/pak/blobs/<sha> -o pak.tar.gz

If you are on macOS name the output file pak.tgz. If you are on Windows, name it pak.zip. Then install it with

R CMD INSTALL <file>

or from R:

install.packages("<file>", repos = NULL, type = "source")

WRT reproducing this, is it OK to show the dependencies of your package? E.g. the output of

desc::desc_get_deps()
desc::desc_get_remotes()

@jonlachmann
Copy link
Author

Thanks, then I can probably solve my immediate issue.

I have managed to narrow down the problem a bit. The issue is that when I arrive at this line https://github.com/r-lib/pkgdepends/blob/bd4b34097fe15f7905d2c97c001a21eb13903996/R/solve.R#L470, some of lp$pkgs$remote are NA.

What are the implications of remote being NA here? Is it something that is expected to happen or is it something that is off?

I am not sure I can post all the dependencies here, maybe I could send you a list in private? It is also a bit strange, since I get the error on some computers but not all.

@gaborcsardi
Copy link
Member

I don't think lp$pkgs$remote should ever be NA.

@gaborcsardi
Copy link
Member

Re dependencies, sure, it is file in private as well.

@gaborcsardi
Copy link
Member

What is your OS and R version?
Does yesterday's build really fix this issue?

@jonlachmann
Copy link
Author

I sent you an email with all the deps.

Running the build from yesterday seems to work, yes. I am thinking it does not have the row from pkgdepends which is causing the issue.

What does lp$pkgs$remote signify? I am trying to understand what the purpose of it is, so I can better assist the debugging!

I am on the machines that are having trouble running Ubuntu 20, and R 4.2.1.

@gaborcsardi
Copy link
Member

OK, I think I know how to fix this.

@gaborcsardi
Copy link
Member

Let me build new pak devel builds. I assume you are on x86_64.

@jonlachmann
Copy link
Author

Let me build new pak devel builds. I assume you are on x86_64.

Yes, correct!

@gaborcsardi
Copy link
Member

OK, should be good now.

@jonlachmann
Copy link
Author

OK, should be good now.

Can confirm that it works now!

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jun 18, 2023
# pak 0.5.1

* No user visible changes.

# pak 0.5.0

* The `meta_*()` functions now consider the `platforms`, `cran_mirror` and
  `r_versions` config entries, see `?"pak-config"`.

* Better Posit Package Manager (PPM) support. New `+ppm_has_binaries()`,
  `ppm_r_versions()`, `ppm_repo_url()`, `ppm_snapshots()` and `ppm_platforms()`
  functions to help interacting with PPM. See the new 'pkgcache and Posit
  Package Manager on Linux' article at https://r-lib.github.io/pkgcache.
  (r-lib/pkgcache#47 and r-lib/pkgdepends#186).

* New `system_r_platform()` and `system_r_platform_data()` functions to query
  the current platform.

* pak now support git repositories as package references. E.g.
  `git::https://github.com/r-lib/pak.git`.

* pak now supports versioned CRAN packages, e.g. `[email protected]` will
  always install dplyr 1.1.1. Note that only CRAN packages are supported,
  Bioconductor packages are not (yet).

* pak now has an alternative system requirements lookup
  implementation. It supports Fedora and Debian systems as well, in
  addition to Debian, Ubuntu, SUSE and RedHat derivatives.
  You can switch to this implementation by setting the
  `R_PKG_SYSREQS2` environment variable to `true`.

* pak now does a better job looking up dependencies for
  hand-selected dependency types. E.g. `dependencies = "LinkingTo"`.

* pak now removes `?ignore`-d packages from dependencies, and
  uses the correct version comparison for `?ignore-before.r`
  (r-lib/actions#708).

* pak now does not fail for circular soft dependencies (#306).

* pak now reports dependency solver failures better in some cases
  (#305, r-lib/pak#474).

* pak now uses locally built CRAN binaries from the cache. Use the
  `?nocache` parameter to opt out from this, or
  `cache_delete(package = ...)` to remove a package from the cache.
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