0

我的 R 安装似乎有问题。我尝试使用几个包 using library(),并被告知找不到它们。然后我尝试library()不带参数地运行,它说Warning message: In library() : library ‘/usr/local/lib/R/site-library’ contains no packages。的输出.libpaths

[1] "/home/username/R/x86_64-pc-linux-gnu-library/3.2"
[2] "/usr/local/lib/R/site-library"                       
[3] "/usr/lib/R/site-library"                             
[4] "/usr/lib/R/library"

的输出sessionInfo()

R version 3.2.3 (2015-12-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 18.3

locale:
 [1] LC_CTYPE=en_AU.UTF-8      
 [2] LC_NUMERIC=C              
 [3] LC_TIME=en_AU.UTF-8       
 [4] LC_COLLATE=en_AU.UTF-8    
 [5] LC_MONETARY=en_AU.UTF-8   
 [6] LC_MESSAGES=en_AU.UTF-8   
 [7] LC_PAPER=en_AU.UTF-8      
 [8] LC_NAME=C                 
 [9] LC_ADDRESS=C              
[10] LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_AU.UTF-8
[12] LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets 
[6] methods   base     

loaded via a namespace (and not attached):
[1] tools_3.2.3

我无法在网上找到有关此错误的任何信息。其他人似乎都有找不到特定软件包的问题。我没有看到有人抱怨没有任何包裹。

这些是我在尝试使用 RStudio 安装“tidyverse”时收到的错误消息install.packages("tidyverse")

Installing package into ‘/home/username/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependencies

...

* installing *source* package ‘colorspace’ ...
** package ‘colorspace’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c colorspace.c -o colorspace.o
colorspace.c:2:19: fatal error: ctype.h: No such file or directory
compilation terminated.
/usr/lib/R/etc/Makeconf:159: recipe for target 'colorspace.o' failed
make: *** [colorspace.o] Error 1
ERROR: compilation failed for package ‘colorspace’
* removing ‘/home/dylanus-zwei/R/x86_64-pc-linux-gnu-library/3.4/colorspace’
Warning in install.packages :
  installation of package ‘colorspace’ had non-zero exit status

这会重复一段时间,然后是:

Found pkg-config cflags and libs!
Using PKG_CFLAGS=
Using PKG_LIBS=-lcurl
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
 * deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
 * rpm: libcurl-devel (Fedora, CentOS, RHEL)
 * csw: libcurl_dev (Solaris)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------

openssl 也会出现同样的错误。我今天早上安装了 libcurl,所以我不确定它在这里期待什么。

checking for gcc... gcc -std=gnu99
checking whether the C compiler works... no

C 编译器肯定可以工作。我已经用过很多次了。其他消息似乎都是同一种东西。

4

1 回答 1

1

由于权限的原因,这可能是一个类似的问题:Library is not writable

尝试安装软件包时出现什么错误消息?当您使用 shell 导航到 site-packages 目录时,它会是什么样子?里面有东西吗?有哪些权限?

总而言之,我们现在已经了解到 drwxr_xr_x,如果您复制了正确目录的行 ( /usr/local/lib/R/site-library),则应该保存包的目录的当前权限是: 。我澄清一下,因为看起来您可能已经复制粘贴了站点目录中第一个包的权限,abind. 如果你这样做了,那么这意味着站点目录中有包,我们有一个不同的问题(可能也是权限问题,但读取而不是写入)。

因此,如果输出以Manual Va的答案ls -ld /usr/local/lib/R/site_library开头,则应该解决该问题。一般来说,将自己添加到员工中并没有什么坏处,但这本身并不能解决您的问题。这是为您修改的答案drwxr-sr-x 6 root staff

做:

$ cd /usr/local/lib/R
$ sudo chmod go+w site-library
$ ls -l

打印的行应如下所示:

drwxrwsrwx 2 root staff 0000 Mar 31 00:00 site-library
于 2018-03-07T09:31:48.100 回答