R无法加载dplyr [英] R unable to load dplyr
问题描述
我正在使用R版本3.4.1从Ubuntu 16运行.我已经安装了 dplyr
,并且可以在我从RStudio运行或从终端向R进行sudo加载时加载.但是,如果我在没有root许可的情况下运行R,由于以下错误,我将无法加载dplyr:
I'm running from Ubuntu 16, using R version 3.4.1. I have dplyr
installed and can load it when either I am running from RStudio or when I sudo into R from the terminal. However, if I run R without root permission, I cannot load dplyr due to the following error:
Error: package or namespace load failed for ‘dplyr’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '<user-directory>/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/libs/Rcpp.so':
<user-directory>/anaconda3/lib/R/bin/exec/../../lib/../.././libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by <user-directory>/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/libs/Rcpp.so)
(在上面,我已将/home/MY_USER_NAME
目录替换为< user-directory>
进行了一些轻微的匿名化).我看过几篇可能与切线有关的文章,但是这些补救措施都没有对我有用.
(where above I've replaced the /home/MY_USER_NAME
dir with <user-directory>
for some mild anonymization). I've seen a couple posts that may be tangentially related, but none of those remedies worked for me.
我很好奇,如果此修复程序像更改某些文件的权限或所有权一样简单,或者问题是对 GLIBCXX_3.4.20
的搜索直接指向了我的 anaconda3
目录(何时不是root ?!)?
I'm curious if the fix is something as simple as changing permissions or ownership of certain files, or if the issue is that the search for GLIBCXX_3.4.20
is directed into my anaconda3
directory (when not root?!)?
在此先感谢您提供任何见解!
Thank you in advance for any insights!
编辑:这可能是从更基本的角度来看我安装R时遇到的问题.通常,我会在RStudio中使用 install.packages(...)
安装软件包,但有时会导致错误,可以通过在输入R作为根用户后使用 install.packages(...)
进行安装来解决. dplyr
和 Rcpp
都是这种情况.即,我刚刚重新安装的版本是
Edit: This may be an issue from a more base level with my installation of R. Often I install packages using install.packages(...)
within RStudio, but on occasion this results in an error that is overcome by installing with install.packages(...)
after entering R as root. This was the case with both dplyr
and Rcpp
. I.e., the versions which I have just reinstalled were done so as
> sudo R
> install.packages( 'Rcpp', dependencies = T )
> install.packages( 'dplyr', dependencies = T )
推荐答案
请通过说明如何安装这些软件包,使问题变得有用且易于理解.
Please make your question useful and understandable by stating how you installed these packages.
它们都来自Ubuntu,即 sudo apt-get install r-cran-dplyr
将获得工作版本,也来自CRAN,即 install.r dplyr
也将(在这里使用littler的 install.r
,在闲暇时使用其他包装器进行 install.packages()
.
They come both from Ubuntu ie sudo apt-get install r-cran-dplyr
will get a working version, and from CRAN ie install.r dplyr
will too (here using my install.r
from littler, use other wrappers to install.packages()
at your leisure).
有时候您的基础库发生了变化,所以我的第一个选择是简单地重新安装Rcpp,然后重新安装dplyr.
Sometimes your underlying libraries change so my first bet would be to simply reinstall Rcpp and then dplyr.
您对/home
的引用建议您从源代码安装,但以 root
身份安装.那是个坏主意.网站上还有很多其他问题,关于何时/何地/如何 apt-get
可能(或可能不)更可取,因此我无需重复.
Your reference to /home
suggests you installed from source, but as root
. That is a bad idea. There a number of other questions answered here on the site about when/where/how apt-get
may (or may not) be preferable so I don't need to repeat this.
响应您的
- 从不做
sudo R
.您想写到/usr/local/lib/R/site-library
,为此,您可以1.a)将自己添加到拥有该目录的组中,或1.b)使其归拥有者所有您的小组,如果只有您在那台机器上. - 您可以只执行
install.packages(c("Rcpp","dplyr"))
,但您甚至不需要这样做,因为dplyr
取决于Rcpp
. - 为什么不使用预构建包?删除已有的文件(即
sudo R CMD REMOVE Rcpp
和dplyr
的同上,然后执行sudo apt-get install r-cran-dplyr
- Never ever do
sudo R
. You want to write to/usr/local/lib/R/site-library
and for that you can 1.a) add yourself to the group owning that directory or 1.b) make it owned by your group if it is just you on that machine. - You could just do
install.packages(c("Rcpp", "dplyr"))
but you don't even need that asdplyr
depends onRcpp
. - Why not use the prebuild package? Remove what you have (ie
sudo R CMD REMOVE Rcpp
and ditto fordplyr
, then dosudo apt-get install r-cran-dplyr
这篇关于R无法加载dplyr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!