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

Unable to install a package due to "invalid argument type" #616

Closed
llrs opened this issue May 17, 2021 · 4 comments
Closed

Unable to install a package due to "invalid argument type" #616

llrs opened this issue May 17, 2021 · 4 comments

Comments

@llrs
Copy link

llrs commented May 17, 2021

Hi, many thanks for making easy to install packages from online resources.

I am stuck with an old R release (not sure if it is still supported) where I can't install a package with remotes on R 3.6.3 on Ubuntu 20.04:

remotes::install_github("fbreitwieser/pavian", force=TRUE)
## Using github PAT from envvar GITHUB_PAT
## Downloading GitHub repo fbreitwieser/pavian@HEAD
## Error: Failed to install 'pavian' from GitHub:
##   invalid argument type
traceback()
## 7: stop(remote_install_error(remotes[[i]], e))
## 6: value[[3L]](cond)
## 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
## 4: tryCatchList(expr, classes, parentenv, handlers)
## 3: tryCatch(res[[i]] <- install_remote(remotes[[i]], ...), error = function(e) {
##        stop(remote_install_error(remotes[[i]], e))
##    })
## 2: install_remotes(remotes, auth_token = auth_token, host = host, 
##        dependencies = dependencies, upgrade = upgrade, force = force, 
##        quiet = quiet, build = build, build_opts = build_opts, build_manual = build_manual, 
##        build_vignettes = build_vignettes, repos = repos, type = type, 
##        ...)
## 1: remotes::install_github("fbreitwieser/pavian", force = TRUE)

I could install it on R 4.0.1 on a Ubuntu 20.04.

Not sure this is related to #546, but my tracing of the error seems to come from a package dependency (I managed to get a different error while exploring the issues Error in !object$is_cran : invalid argument type).

@jimhester
Copy link
Member

This is likely due to a dependency already installed on your system, it is tricky to determine which one, but you can do it using options(error = recover) and figuring out the package name by inspecting objects further up the call stack.

@llrs
Copy link
Author

llrs commented May 17, 2021

I was unable to understand how are the dependencies related to failing to install the package.
I tried manually to install the dependencies and found out that the problem exists for one of the (remote) dependencies: fbreitwieser/sankeyD3 even after I installed all the declared dependencies. Not sure what is going on and I can't dedicate more time on this. Many thanks for the quick reply and your support.

@llrs
Copy link
Author

llrs commented Dec 10, 2021

I had finally time to look this up. Writing this in case other find themselves on the same error.

Using the options(error = recover) I went down the rabbit hole till update.packages_deps were on (object$diff == UNAVAILABLE | object$diff == UNINSTALLED) & !object$is_cran L277 crashes because object is NULL because upgradable_packages a couple of lines above returned NULL. This was due to my .Renviron having the following line:

R_REMOTES_UPGRADE="ask" # https://remotes.r-lib.org/reference/update_packages.html

However Sys.getenv doesn't strip comments and returned:

Sys.getenv("R_REMOTES_UPGRADE")
# "ask # https://remotes.r-lib.org/reference/update_packages.html"

The simple fix was moving the comment above the line:

# https://remotes.r-lib.org/reference/update_packages.html
R_REMOTES_UPGRADE="ask" 

@francisbarton
Copy link

Thanks @llrs that is really helpful. I just had the Error in !object$is_cran : invalid argument type error when running devtools::install() - it was because I had just added R_REMOTES_UPGRADE = FALSE to my .Renviron.

I don't think it likes FALSE in that file (it would be OK as an argument to the function), so I have changed it to "never" instead, and that's fine.

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

3 participants