R package 'ps' fails to install because permission denied to mv in final step of install
Asked Answered
N

3

17

I'm trying to install R: devtools, and a single dependency (ps) is failing to install, cascading into lack of dependencies. I'm using WSL Ubuntu on Windows 10, R 3.6, and the current RStudio version.

It fails in all situations (using RStudio, accessing through command prompt, starting all the above in admin mode, starting R using sudo). I've also tried turning off my firewall as suggested by other questions around similar issues. Finally, I've tried installing it to other .libPaths() locations. Other packages install just fine. I haven't tried installing from source- because I'd need devtools to do so.

Based on the error messages, the command mv does not have permission to move the installed package from its temporary install directory to the final location in my package library (but the installation utility has no trouble making directories or writing files). Anyone have any ideas why this could happen with just this single package? I'm baffled.

> install.packages('ps')
Installing package into ‘/usr/lib/R/library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/ps_1.3.0.tar.gz'
Content type 'application/x-gzip' length 261887 bytes (255 KB)
==================================================
downloaded 255 KB
* installing *source* package ‘ps’ ...
** package ‘ps’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -g -O2 -fdebug-prefix-map=/build/r-base-VjHo9C/r-base-3.6.0=. - fstack-protector-strong -Wformat -Werror=format-security -Wdate-time - D_FORTIFY_SOURCE=2 -g  -Wall px.c -o px

a bunch of other code that I am too no0b to understand

gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o ps.so init.o api-common.o common.o extra.o dummy.o posix.o api-posix.o linux.o api-linux.o -L/usr/lib/R/lib -lR
installing via 'install.libs.R' to /usr/lib/R/library/00LOCK-ps/00new/ps
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
mv: cannot move '/usr/lib/R/library/00LOCK-ps/00new/ps' to
'/usr/lib/R/library/ps': Permission denied
ERROR:   moving to final location failed
The downloaded source packages are in
‘/tmp/Rtmpm7SpMt/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("ps") :
installation of package ‘ps’ had non-zero exit status
Nevus answered 16/6, 2019 at 2:59 Comment(4)
We had something similar reported on r-sig-debian the other day -- apparently swapping WSL for WSL2 helped as the mv semantics are/were not correct in WSL. If walks and quacks like Linux ... it is still a not a duck. Emulator layers are hard.Goodfornothing
Thanks @DirkEddelbuettel for the suggestion- I'll try the switch and report back. Any thoughts about why just this one package and not any others?Nevus
I am encountering this after switching to wsl2, confusingly enough...Jp
I installed many packages successfully in WSL1, but see that problem installing "xml2". Very odd. I did the workaround from @Tob Sys.setenv(R_INSTALL_STAGED = FALSE) and after that xml2 did install. For me, WSL2 is not allowed by company policy on VPN, it is a known bug in WSL2. Hoping that changes.Batish
U
26

Setting this before installing ps solved in my WSL ubuntu 18.04.2 LTS with R 3.6.0 on Windows 10 Pro. May help your case.

Sys.setenv(R_INSTALL_STAGED = FALSE)

https://developer.r-project.org/Blog/public/2019/02/14/staged-install/

“Non Zero Exit Status” R 3.6.0 "Biobase"

Uraeus answered 24/6, 2019 at 22:24 Comment(1)
Verified! Still worked with WSL 1 on 2021-03-04 to install "xml2" package.Batish
C
0

Try installing from terminal as super user

sudo su - -c "R -e \"install.packages('ps', repos='http://cran.rstudio.com/')\""

If that works, then you have to check permissions for your library folder.

Cetane answered 16/6, 2019 at 4:0 Comment(1)
Just tried it, no luck, but thanks for the suggestion. The reason I'm so confused is, why just this one package? A permissions mix-up would make sense if other packages also had the same problem, but this is the only! one!Nevus
D
0

Try installing using pak(); This downloads the development version. You need pak library to be installed

pak::pak("r-lib/ps")

This worked for me

Desta answered 12/8 at 20:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.