库中的错误(qdap):没有名为'qdap'的包

时间:2017-07-13 07:40:42

标签: r rjava install.packages qdap

我已经安装了qdap:

install.packages("qdap")

需要一段时间才能下载所有内容,但控制台会填满所有下载内容,最后我收到这样的消息:

Warning in install.packages :
  installation of package ‘qdap’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpeTzuKz/downloaded_packages’
> library(qdap)
Error in library(qdap) : there is no package called ‘qdap’
> 

This SO帖子让我尝试添加dependencies = TRUE,但问题仍然存在。

这是会话信息

sessionInfo():
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS

Matrix products: default
BLAS: /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.18.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             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] compiler_3.4.0 tools_3.4.0   

我昨天发现的另一篇文章(现在用谷歌搜索找不到它)建议我删除我的库目录中的现有qdap文件,关闭我的会话,重新启动和全新安装。没有一个包完全称为qdap,但有一些在我删除的名称中有qdap。我的问题仍然存在,我无法安装qdap。

我不确定提供哪些其他信息?任何帮助表示赞赏。

以下是尝试安装qdap时生成的错误:

  

./ configure:第3736行:/ usr / lib / jvm / default-java / jre / bin / java:否   这样的文件或目录没有配置:错误:Java解释器   '/ usr / lib / jvm / default-java / jre / bin / java'不起作用错误:   包“rJava”的配置失败   *删除'/home/myname/R/x86_64-pc-linux-gnu-library/3.4/rJava'在install.packages中的警告:安装包'rJava'已经   非零退出状态错误:依赖'rJava'不可用   包'openNLPdata'   *删除'/home/myname/R/x86_64-pc-linux-gnu-library/3.4/openNLPdata'警告   在install.packages中:安装包'openNLPdata'了   非零退出状态错误:依赖'rJava'不可用   包'xlsxjars'   *删除'/home/myname/R/x86_64-pc-linux-gnu-library/3.4/xlsxjars'在install.packages中的警告:安装包'xlsxjars'已经   非零退出状态错误:依赖'rJava'不可用   包''venneuler'   *删除'/home/myname/R/x86_64-pc-linux-gnu-library/3.4/venneuler'警告   在install.packages:安装包'venneuler'了   非零退出状态错误:依赖项'openNLPdata','rJava'是   不适用于“openNLP”套餐   *删除'/home/myname/R/x86_64-pc-linux-gnu-library/3.4/openNLP'在install.packages中的警告:'openNLP'软件包的安装有   非零退出状态错误:依赖项'rJava','xlsxjars'不是   可用于'xlsx'包   *删除'/home/myname/R/x86_64-pc-linux-gnu-library/3.4/xlsx'在install.packages中的警告:包'xlsx'的安装有   非零退出状态错误:依赖关系'openNLP','venneuler',   'xlsx'不适用于'qdap'包   *删除'/home/myname/R/x86_64-pc-linux-gnu-library/3.4/qdap'在install.packages中警告:安装包'qdap'已经   非零退出状态

由于这看起来像是一个rJava问题,我发现了this帖子并在终端中尝试了最高投票答案:

apt-get install r-cran-rjava

导致:

E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

我希望在没有root用户的情况下解决这个问题?我对linux并不熟悉。我可以安装其他p包。

1 个答案:

答案 0 :(得分:1)

There is a solution for this issue when you have no root access.

  1. Download Java (make sure to install JDK) and install it inside your $HOME

    You can do that as Oracle's Java is just a tar.gz package

  2. Make sure to set JAVA_HOME

    export JAVA_HOME=$HOME/opt/my_jdk_installation
    
  3. Once you have Java you have to reconfigure R

    Simply tell R where your Java is

    R CMD javareconf \
    JAVA_HOME=${JAVA_HOME} \
    JAVA=${JAVA_HOME}/bin/java \
    JAVAC=${JAVA_HOME}/bin/javac \
    JAVAH=${JAVA_HOME}/bin/javah \
    JAR=${JAVA_HOME}/bin/jar \
    JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/jre/lib/server \
    JAVA_CPPFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux"
    

Since now, R should use your personal installation of Java. This way, you don't depend on sys admin.