“qdap”包加载失败,出现多个错误。

huangapple go评论101阅读模式
英文:

Package ("qdap") fails to load with multiple errors

问题

在安装qdap时,我没有遇到任何错误。但在加载库时,我遇到了以下错误。

> library(qdap)
Loading required package: qdapDictionaries
Loading required package: qdapRegex
Loading required package: qdapTools
Loading required package: RColorBrewer
Error: package or namespace load failed for ‘qdap’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: 无法从注册表中确定JAVA_HOME

我在另一个问题中看到,我们需要安装64位的JAVA(因为我的Win 10是64位),并设置JAVA_HOME到相应的目录。

> Sys.setenv(JAVA_HOME='C:/Program Files (x86)/Java/jre1.8.0_231')
> library(qdap)
Error: package or namespace load failed for ‘qdap’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: 无法加载共享对象'C:/Users/Admin/Documents/R/win-library/3.6/rJava/libs/x64/rJava.dll':
  LoadLibrary 失败:%1 不是有效的 Win32 应用程序。

我已经卸载并安装了最新的R软件(3.6.2;我已经检查了32位和64位选项),也重新启动了R-studio,但没有成功。

英文:

While installing qdap I have not faced any errors. But when loading the library, I face the follwing errors.

> library(qdap)
Loading required package: qdapDictionaries
Loading required package: qdapRegex
Loading required package: qdapTools
Loading required package: RColorBrewer
Error: package or namespace load failed for ‘qdap’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: JAVA_HOME cannot be determined from the Registry

I read in another question that we need to install the JAVA 64bit (as my Win 10 is 64-bit) and load the JAVA home. So I downloaded the 64-bit java file and also set the JAVA_HOME to the directory.

> Sys.setenv(JAVA_HOME='C:/Program Files (x86)/Java/jre1.8.0_231')
> library(qdap)
Error: package or namespace load failed for ‘qdap’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 'C:/Users/Admin/Documents/R/win-library/3.6/rJava/libs/x64/rJava.dll':
  LoadLibrary failure:  %1 is not a valid Win32 application.

I have uninstalled and installed the latest R software (3.6.2; I've checked both 32-bit and 64-bit options), restarted R-studio as well, to no avail.

答案1

得分: 0

问题已经解决。虽然我不是100%确定是什么解决了,但我已经做了以下操作。

错误%1 不是有效的 Win32 应用程序 指示32位。

所以我启动了Rgui控制台(32位)(从目录C:\Program Files\R\R-3.6.2\bin\i386 打开)。library(rJava) 命令正常运行,library(qdap) 也正常运行。

然后我在Rstudio中更改了选项,选择了32位的R [工具 -> 选项 -> 通用]。但是设置这个选项会影响高内存消耗的执行。过了一段时间(当我开始遇到内存问题时),我切换了RStudio以使用64位的R。

之后错误就不再出现了,我成功加载了'qdap'库。

英文:

The issue is fixed. Although I'm not 100% sure what solved, here is what i have done.

The error %1 is not a valid Win32 application. is indicating 32-bit.

So I started Rgui console (32-bit) (opened from the directory C:\Program Files\R\R-3.6.2\bin\i386 ). The library(rJava) command works well and so does library(qdap).

Then I changed the options in Rstudio to choose 32-bit R [Tools -> Options -> General]. But setting this will impact high memory consuming executions. After a while (when I started facing memory issues), I switched the RStudio to use the 64-bit R.

The error did not appear after that and I was able to load the 'qdap' library.

huangapple
  • 本文由 发表于 2020年1月7日 00:04:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/59615269.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定