I'm having trouble installing R packages from VSCode using the R extension v5.2.3. The directory /usr/local/lib/R/site-library that VSCode is trying to write to is not writeable. This is the directory that is used when I start R as root and install R packages from the console. This is where I want my R packages to live.
This is the error I get when using VSCode to install the R package here. Note that I start VSCode as a normal user.
Executing task: /usr/bin/R --silent --slave -e install.packages(c('here'),repos='https://cloud.r-project.org/')
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages(c("here"), repos = "https://cloud.r-project.org/") :
'lib = "/usr/local/lib/R/site-library"' is not writable
Error in install.packages(c("here"), repos = "https://cloud.r-project.org/") :
unable to install packages
Execution halted
* The terminal process "/usr/bin/R '--silent', '--slave', '-e', 'install.packages(c('here'),repos='https://cloud.r-project.org/')'" failed to launch (exit code: 1).
* Terminal will be reused by tasks, press any key to close it.
This post describe the same error on windows. But with no solution...
So, is there a way to manage my R packages from VSCode using the global library /usr/local/lib/R/site-library?
My Linux info:
~$ uname -rvmpo
5.15.0-48-generic #54~20.04.1-Ubuntu SMP Thu Sep 1 16:17:26 UTC 2022 x86_64 x86_64 GNU/Linux
And the R ditto:
> sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 20.3
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=sv_SE.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=sv_SE.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=sv_SE.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.2.1
Related
I am installing R through conda as follows on Ubuntu 18.04.
v=3.6.0
conda create -n env-r${v} -c r r=${v} r-ggplot2 r-gridExtra r-gtable r-tidyr r-devtools
conda activate env-r${v}
That runs ok. It installs 3.6.1 instead of 3.6.0. And then when I use R, for example, installing a package not on conda;
Rscript -e 'install.packages("label.switching", repos="https://cran.rstudio.com")'
I get this error:
Error in path.expand(new) : object 'lb' not found
Calls: .First ... .libPaths -> Sys.glob -> path.expand -> path.expand
Execution halted
If I open R and run stuff in it, there are more errors:
Error in path.expand(new) : object 'lb' not found
Calls: .First ... .libPaths -> Sys.glob -> path.expand -> path.expand
Execution halted
Error in i.p(...) :
(converted from warning) installation of package ‘rlang’ had non-zero exit status
Running conda 4.7.5.
Ran sessionInfo() inside R.
>> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-conda_cos6-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS
Matrix products: default
BLAS/LAPACK: /home/roy/miniconda3/envs/env-r3.6.0/lib/libopenblasp-r0.3.6.so
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.1
I am trying to install stringi package in R, but the installation never finishes. After the download and some compilation, I get the following message:
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/marcus/R/x86_64-redhat-linux-gnu-library/3.3/stringi/libs/stringi.so':
/lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /home/marcus/R/x86_64-redhat-linux-gnu-library/3.3/stringi/libs/stringi.so)
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/marcus/R/x86_64-redhat-linux-gnu-library/3.3/stringi’
The downloaded source packages are in
‘/tmp/RtmpT5KQVP/downloaded_packages’
Warning message:
In install.packages("stringi") :
installation of package ‘stringi’ had non-zero exit status
I searched the internet and I couldn't understand what this error message means. If it helps, this is my sessionInfo():
R version 3.3.1 (2016-06-21)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.3.1
I solved my problem installing gcc 4.9.2. To do so, I ran
$ sudo yum install devtoolset-3-gcc-c++
$ sudo yum install devtoolset-3-gcc-gfortran
$ scl enable devtoolset-3 bash
in the shell. The first two commands install gcc and gfortran. The last one makes gcc 4.9.2 the standard compiler in the system. After that, I opened R and ran install.packages("stringi") to have my problem solved.
I'm doing some heavy work with my computer. I'd like R used the 4 processors . But, used one at a time. I think the parallel package can be useful, but is not available. What I can do?
When I try to install the following appears
> install.packages("parallel")
Installing package into ‘/home/hector/R/x86_64-pc-linux-gnu-library/3.3’
Warning in install.packages :
package ‘parallel’ is not available (for R version 3.3.1)
Warning in install.packages :
package ‘parallel’ is a base package, and should not be updated
Here is my sessionInfo:
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.4 LTS
locale:
[1] LC_CTYPE=es_CL.UTF-8 LC_NUMERIC=C LC_TIME=es_CL.UTF-8
[4] LC_COLLATE=es_CL.UTF-8 LC_MONETARY=es_CL.UTF-8 LC_MESSAGES=es_CL.UTF-8
[7] LC_PAPER=es_CL.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=es_CL.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.3.1
Some packages are coming with R as recommended packages, like parallel, compiler and mgcv. You don't need to install or update them; when you upgrade your R version, they will be upgraded, too, if new package release is available.
These packages are not loaded on R start-up; but you can get them immediately by
library(parallel)
library(compiler)
library(mgcv)
an so on.
I have just initiated a EC2 server on AWS and I'm trying to install a package from
github called 'krose/skm'. The package is installed without any issues on Windows, but not on Ubuntu. All dependencies are installed. I can't figure out why it can install on Windows, but not Ubuntu.
library(devtools)
install_github('krose/skm')
And the result of running the code above is:
Downloading GitHub repo krose/skm#master
from URL https://api.github.com/repos/krose/skm/zipball/master
Installing skm
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet \
CMD INSTALL '/tmp/RtmpxJg8N7/devtools1b887e511e96/krose-skm-059766b' \
--library='/usr/local/lib/R/site-library' --install-tests
* installing *source* package ‘skm’ ...
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in namespaceExport(ns, exports) :
undefined exports: skm_umm_stations, skm_ummquery, skm_webquery
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/site-library/skm’
Error: Command failed (1)
The functions are documented using Roxygen2 and are exported. The functions are not assigned using <<-.
Here is my sessionInfo()
R version 3.2.5 (2016-04-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.4 LTS
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devtools_1.11.1
loaded via a namespace (and not attached):
[1] httr_1.1.0 R6_2.1.2 tools_3.2.5 withr_1.0.1 curl_0.9.7
[6] memoise_1.0.0 git2r_0.14.0 digest_0.6.9
I don't have much experience with Ubuntu.
UPDATE: The R CMD check has the following two notes:
* checking DESCRIPTION meta-information ... NOTE
License components which are templates and need '+ file LICENSE':
MIT
* checking top-level files ... NOTE
Non-standard file/directory found at top level:
'README.Rmd'
The R directory in the package was misnamed as r. Windows didn't pick up on the difference, since it is more forgiving about differences in case for file and directory names.
I am trying to use the Rcartogram package. After following the instructions in the answer by Geoff, I received an error that I can't resolve:
C:\R\R-3.2.3\library\Rcartogram>R CMD INSTALL --debug .
processing '.'
a directory
* installing to library 'C:/R/R-3.2.3/library'
* build_help_types=
* DBG: 'R CMD INSTALL' now doing do_install()
* created lock directory 'C:/R/R-3.2.3/library/00LOCK-Rcartogram'
ERROR: cannot install to srcdir for package 'Rcartogram'
* removing C:/R/R-3.2.3/library/Rcartogram
I have tried running R CMD INSTALL in other directories, as well as changing the flags as suggested in the linked answer. They either return the same error, or an error that there is no packages specified. What can I do to debug this error?
sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.2.3