R库不包含任何包

时间:2018-03-05 10:23:27

标签: r r-package r-library

我的R安装似乎有问题。我尝试使用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

我无法在线找到有关此错误的任何信息。其他人似乎都没有找到特定的包。我没有看到有人抱怨没有任何包裹。

这些是我尝试使用install.packages("tidyverse")从RStudio安装“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编译器绝对有效。我已经多次使用它了。 其他消息似乎都是同一类。

1 个答案:

答案 0 :(得分:0)

由于权限Library is not writable

,这可能是一个类似的问题

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

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

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

执行:

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

印刷线应如下所示:

drwxrwsrwx 2 root staff 0000 Mar 31 00:00 site-library