0

I am running Ubuntu 18.04 on Windows 10 WSL. I originally installed R 3.6 following this guide: R-CRAN-Linux-Ubuntu-Installation. This question is related to: Permission denied while installing R package. I am writing a new question instead of commenting on the former because I don't have sufficient reputation. I tried to follow the instructions in the only answer in that post, however uninstalling R 3.6 and installing R 3.4 from default ubuntu repositories results in a similar error (below).

Finally, I cannot install ps from apt using the same pattern as r-cran-xml2, as no such package (r-cran-ps) exists on bionic. r-cran-ps is available on disco. I am trying to install ps because it is a dependency of rlib TSclust.

I can run R 3.6 on Windows without any problem so I expect this is related to WSL Ubuntu. Any advice or references from others who are familiar with this error is appreciated.

> ~/code/real-estate-lab/R$ sudo -E R

R version 3.6.1 (2019-07-05) -- "Action of the Toes" Copyright (C) 2019 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R.

> install.packages("ps") Installing package into ‘/usr/local/lib/R/site-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-uuRxut/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -Wall px.c -o px
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-uuRxut/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-uuRxut/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c api-common.c -o api-common.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-uuRxut/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c common.c -o common.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-uuRxut/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c extra.c -o extra.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-uuRxut/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c dummy.c -o dummy.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-uuRxut/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c posix.c -o posix.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-uuRxut/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c api-posix.c -o api-posix.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-uuRxut/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c linux.c -o linux.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-uuRxut/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c api-linux.c -o api-linux.o
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/local/lib/R/site-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/local/lib/R/site-library/00LOCK-ps/00new/ps' to '/usr/local/lib/R/site-library/ps': Permission denied ERROR: moving to final location failed

The downloaded source packages are in ‘/tmp/RtmpG1GgKd/downloaded_packages’ Warning message: In install.packages("ps") : installation of package ‘ps’ had non-zero
exit status
> q()

0

1 Answer 1

0

Have you tried the other solution given to the related question you mentioned?

install.packages("ps", dependencies=TRUE, INSTALL_opts = c('--no-lock'))

Note that using sudo for installing packages, although a quick workaround, will trap you into having to quit and restart R every time you want to remove or update your packages created in a sudo R session.

1
  • Thank you. I think this error is related to machine-specific constraints. Was an engineering laptop built for corporate environment. I continued to have serious challenges with WSL and stopped using it entirely. Using R on Windows itself turned out fine for my case as I just needed to do data analysis. Dec 23, 2019 at 16:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .