简体   繁体   English

R库不包含任何程序包

[英]R library contains no packages

My installation of R seems to be faulty. 我的R安装似乎有问题。 I tried using several packages using library() , and was told they could not be found. 我尝试使用library()使用多个软件包,并被告知找不到它们。 I then tried just running library() with no arguments, and it said Warning message: In library() : library '/usr/local/lib/R/site-library' contains no packages . 然后,我尝试只运行不带任何参数的library() ,并显示Warning message: In library() : library '/usr/local/lib/R/site-library' contains no packages The output of .libpaths is .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"

The output of sessionInfo() is 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

I have not been able to find any information on this error online. 我无法在线找到有关此错误的任何信息。 Everyone else seems to have a problem with not finding specific packages. 其他所有人似乎都找不到特定的软件包。 I have not seen anyone complain about having no packages whatsoever. 我还没有看到有人抱怨没有任何包装。

These are the error messages I have received when attempting to install "tidyverse" from RStudio using install.packages("tidyverse") : 这些是我尝试使用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

This repeats for a while, followed by: 重复一段时间,然后执行以下操作:

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=...'
--------------------------------------------------------------------

The same error arises for openssl. 对于openssl也会出现相同的错误。 I installed libcurl this morning, so I'm not sure what it's expecting here. 我今天早上安装了libcurl,所以不确定在这里期望什么。

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

The C compiler definitely works. C编译器肯定可以工作。 I have used it many times. 我已经使用了很多次。 The other messages all seem to be the same kind of thing. 其他消息似乎都是同一种东西。

This could be a similar problem, due to permissions: Library is not writable 由于权限的原因,这可能是一个类似的问题: 库不可写

What's the error message when you try installing packages? 尝试安装软件包时,错误消息是什么? And what does the site-packages directory look like when you navigate to it using a shell? 当您使用shell导航到site-packages目录时,它看起来像什么? Is there anything in there? 里面有东西吗? What are the permissions? 有哪些权限?

To summarize, we've now learned that the current permissions for the directory that is supposed to hold the packages are: drwxr_xr_x , if you copied the line for the correct directory ( /usr/local/lib/R/site-library ). 总而言之,我们现在了解到,用于保存软件包的目录的当前权限为: drwxr_xr_x ,如果您复制了正确目录的行( /usr/local/lib/R/site-library )。 I'm clarifying because it looks like you may have copy pasted the permissions for the first package in your site-directory, abind . 我正在澄清,因为您似乎已复制复制粘贴了站点目录abind第一个软件包的权限。 If you did, then it means there are packages in site-directory and we have a different problem (possibly also a permissions problem, but read rather than write). 如果您这样做了,那么这意味着站点目录中有软件包,并且我们有另一个问题(可能还有权限问题,但不是读取而是写入)。

So if the output of ls -ld /usr/local/lib/R/site_library starts with drwxr-sr-x 6 root staff the answer, by Manual Va , from that question that should resolve things. 因此,如果ls -ld /usr/local/lib/R/site_librarydrwxr-sr-x 6 root staff开头,则应该由手册Va回答应该解决问题的问题。 It wouldn't hurt to add yourself to staff, in general, but that by itself won't solve your problem. 通常,将自己添加到员工中不会有什么坏处,但这本身并不能解决您的问题。 Here's the modified answer for you 这是为您修改的答案

Do: 做:

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

The printed line should look like this: 打印的行应如下所示:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM