Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 880
klauck Avatar asked Jun 16 '19 02:06

klauck


People also ask

Can install packages in R Permission denied?

If R (or RStudio with R) was installed as administrator in Windows and you try to install or update a package you lack of permissions. Either run the installation as admin or avoid the installation as admin.

Why I Cannot install package in R?

Changing the configuration in R Studio to solve install packages issue. Go To Tools -> Global option -> Packages. Then uncheck the option “Use secure download method for HTTP”. For other RStudio issues refer to official Troubleshooting Guide here.

How do I install a .ZIP file in R?

Go into R, click on Packages (at the top of the R console), then click on "Install package(s) from local zip files", then find the zip file with arm from wherever you just saved it. Do the same thing to install each of the other packages you want to install.

What is the correct way to install the packages in R?

Open R via your preferred method (icon on desktop, Start Menu, dock, etc.) Click “Packages” in the top menu then click “Install package(s)”. Choose a mirror that is closest to your geographical location. Now you get to choose which packages you want to install.


1 Answers

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"

like image 198
Tob Avatar answered Sep 22 '22 04:09

Tob