-
Notifications
You must be signed in to change notification settings - Fork 62
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
Error: <callr_remote_error: Failed to move installed package at '/usr/local/lib/R/site-library/ps'> #251
Comments
For the record, #175 is not a related issue, that is a download error, this one is an installation error. I am not sure why it happens, but it has to do something with the permissions of the library directory on that Docker image. E.g. this is successful: > dir.create(lib <- tempfile())
> pak::pak("ps", lib = lib)
→ Will install 1 package.
→ Will download 1 CRAN package (115.13 kB).
+ ps 1.5.0 [bld][cmp][dl] (115.13 kB)
ℹ Getting 1 pkg (115.13 kB)
✔ Got ps 1.5.0 (source) (350.08 kB)
✔ Downloaded 1 package (350.08 kB) in 1.4s
ℹ Building ps 1.5.0
✔ Built ps 1.5.0 (478ms)
✔ Installed ps 1.5.0 (37ms)
✔ 1 + 0 pkgs | kept 0, updated 0, new 1 | downloaded 1 (350.08 kB) 2.6s |
It is more clear when running the underlying pkgdepends commands: > p <- pkgdepends::new_pkg_installation_proposal("ps")
> p$solve()
✔ Loading global cached package metadata ... done
> p$download()
ℹ Getting 1 pkg (115.13 kB)
✔ Cached copy of ps 1.5.0 (source) is the latest build
✔ No downloads needed, all packages are cached
> p$install()
ℹ Building ps 1.5.0
✔ Built ps 1.5.0 (441ms)
⸨▒▒▒▒▒▒▒▒▒▒▒▒▒⸩ | 📦 1/1 | ✅ 0/1 ⠙ 1 | installing ps
Error: <install_filesystem_error in install_extracted_binary(filename, lib_cache, pkg_cache, lib, ...:
Failed to move installed package at '/usr/local/lib/R/site-library/ps'>
See `.Last.error.trace` for a stack trace.
Warning message:
In file.rename(installed_path, move_to) :
cannot rename file '/usr/local/lib/R/site-library/ps' to '/usr/local/lib/R/site-library/_cache/ps/file3c256916315', reason 'Invalid cross-device link' |
The permissions for that directory in the container: drwxrwsr-x 1 root staff 4.0K Dec 13 19:33 site-library Could it be a "staged install" thing where ps already is loaded and used by pak and some lock during a staged install phase prevents it from be "replaced"? |
No, locking is advisory on Linux. It seems like it is not the permissions, but a Docker issue. We can try to work around it. |
I am fairly sure that the issue is that the package (e.g. ps) is already installed on the parent image, and pak tries to move/rename its directory before the installation. For Docker this is a move/rename between devices. We can try to copy + delete if the move fails. |
I also stumbled upon this issue when trying to update my R install scripts from Has there been any workaround for this? So far I've been doing packs <- as.data.frame(installed.packages())
if (!pak %in% packs$Package) {
pak::pkg_install(
pak
)
} But that feels like a hack :) |
@gaborcsardi Any updates on this or solutions that we can use to circumvent the problem? The above "hack" by ColinFay is only relevant for packages themselves and not their dependencies (e.g., if |
A (hopefully) more "resilient" version of the hack from @ColinFay that also excludes dependencies: new_pkgs = c("tibble", "rlang", "fansi")
p <- pkgdepends::new_pkg_installation_proposal(new_pkgs)
p$solve()
sol <- p$get_solution()
sol_pkgs <- s$data$package
installed_pkgs <- installed.packages()[, "Package"]
# Remove any packages suggested by the solution which are already installed (regardless of version)
to_install <- setdiff(sol_pkgs, installed_pkgs )
pak::pkg_install(to_install, dependencies = FALSE) An obvious disadvantage of this approach is that if one of the packages you have already installed is super old, |
I also get biten by this in a docker setting. The comment to try copy + delete was from the end of 2020. I would be interested to know if there have been some attempts to troubleshoot this or if it's possibly a dead end? |
My current work around... Add a local library to your docker's Rprofile. Install your packages there.
By using a local lib:
|
@schloerke I tried this workaround but I still get the error
The goal is to have a common base image, add test dependencies in a Snippet from
Do you have an idea what could be wrong here? |
I guess the second pak call is trying to update a package that was installed in the first pak call. |
@gaborcsardi this also happens with a minimal
and
I thought that workaround with a custom library path might fix this permission (?) issue as described. Is there another way to install only |
I am going to try to fix this now. A small reprex
|
OK, this is now fixed in pkgdepends, and the nightly
|
@gaborcsardi awesome, thanks so much! |
# pak 0.4.0 * pak has much improved and more informative error messages now. This work is not yet finished, so if you find an unclear error message, please open an issue. Thank you! * The solver is now more robust for non-canonical input (e.g. `DESCRIPTION` files) (r-lib/pak#423). * Better installation output. Standard output and error are now collected together (r-lib/pkgdepends@0669f0f8c). * The solver is now doing a better job when multiple versions of the same package are present in the same repository (r-lib/actions#559). * `pkg_name_check()` now works again, it needed a fix after changes at https://crandb.r-pkg.org. * Explicit package names in local and URL package sources, as in `package=local::...` or `package=url::...` are now parsed correctly in dependencies. * pak is now more robust to `Archs` fields missing from the CRAN metadata for packages with compiled code (r-lib/pak#448). * `url::` packages now always work correctly, even if the digest package is not installed (r-lib/pak#433). * pak is now more robust when installing packages from subdirectories of GitHub repositories (r-lib/pak#431, @paleolimbot). * Parameters `?reinstall`, `?source` and `?ignore` now work correctly when specified in the `package=?parameter` format (#294). * The `?ignore` parameter works correctly now. * Dependency resolution now does not fail if a package is not found. * pak can now install `url::` remotes from GitHub. * pak now does not fail when the package of a `.tar.gz` GitHub snapshot is in a subdirectory, or in a subdirectory of a subdirectory. * pak now errors early if it cannot deduce the name of the package from a `Remotes` or `Config/Needs/*` entry. * Solver failures now include details in some cases where previously they did not. * pak can now update packages in Docker containers where the old version was installed in the different Docker later (r-lib/pak#251) * Update R version -> Bioconductor version mapping. R 4.2.x now maps to Bioconductor 3.16.
Reproducible steps
Make a build with
docker build .
using the Dockerfile below:Log
Stack trace:
Related issue
#175
The text was updated successfully, but these errors were encountered: