加载本机库时出错:无法加载库“msvcr120”R NetLogo

加载本机库时出错:无法加载库“msvcr120”R NetLogo

我收到以下错误,我认为是nlrx,因为现在 NetLogo 中的 R 扩展问题已经解决,模型将在 NetLogo 中运行。r.jar 和 jna-4.2.2.jar 文件都在那里。当我尝试在 R 中启动模拟时,几乎立即生成错误。

R 的nlrx包在 Netlogo 中运行模拟,它使用 R 中 GAMS 的非线性求解器,使用 NetLogo 的 R 扩展来选择活动。我已在 Linux 环境中成功使用了该模型,因此该过程有效。NetLogo 模型将在 NetLogo 中运行,我认为这意味着 R 扩展已正确设置。

有任何想法吗?

C:\Users\zejas\AppData\Roaming\NetLogo\6.1\extensions\r>ls
GPL.txt  jna-4.2.2.jar  models  r.jar  user.properties
PS C:\Users\zejas> gci env:

Name                           Value
----                           -----
ALLUSERSPROFILE                C:\ProgramData
APPDATA                        C:\Users\zejas\AppData\Roaming
CLASSPATH                      C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext
CommonProgramFiles             C:\Program Files\Common Files
CommonProgramFiles(x86)        C:\Program Files (x86)\Common Files
CommonProgramW6432             C:\Program Files\Common Files
COMPUTERNAME                   DESKTOP-HM68BSI
ComSpec                        C:\Windows\system32\cmd.exe
DriverData                     C:\Windows\System32\Drivers\DriverData
FPS_BROWSER_APP_PROFILE_STRING Internet Explorer
FPS_BROWSER_USER_PROFILE_ST... Default
HOMEDRIVE                      C:
HOMEPATH                       \Users\zejas
JAVA_HOME                      C:\Program Files\Java\jdk1.8.0_221\
LOCALAPPDATA                   C:\Users\zejas\AppData\Local
LOGONSERVER                    \\DESKTOP-HM68BSI
netlogo                        C:\Program Files\NetLogo 6.1.0\app\netlogo-6.1.0.jar
NUMBER_OF_PROCESSORS           8
OneDrive                       C:\Users\zejas\OneDrive
OS                             Windows_NT
Path                           C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java;C...
PATHEXT                        .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL
PROCESSOR_ARCHITECTURE         AMD64
PROCESSOR_IDENTIFIER           Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
PROCESSOR_LEVEL                6
PROCESSOR_REVISION             5e03
ProgramData                    C:\ProgramData
ProgramFiles                   C:\Program Files
ProgramFiles(x86)              C:\Program Files (x86)
ProgramW6432                   C:\Program Files
PSModulePath                   C:\Users\zejas\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell...
PUBLIC                         C:\Users\Public
R                              C:\Program Files\Microsoft\R Open\R-3.5.3\bin\x64\R.exe
R_HOME                         C:\Program Files\Microsoft\R Open\R-3.5.3
R_LIBS                         C:\Program Files\Microsoft\R Open\R-3.5.3\library
R_LIBS_USER                    C:\Users\zejas\Documents\R\win-library\3.5
RPATH                          C:\Program Files\Microsoft\R Open\R-3.5.3\bin\x64
rtools_path                    C:\Rtools\bin
SESSIONNAME                    Console
SystemDrive                    C:
SystemRoot                     C:\Windows
TEMP                           C:\Users\zejas\AppData\Local\Temp
TMP                            C:\Users\zejas\AppData\Local\Temp
USERDOMAIN                     DESKTOP-HM68BSI
USERDOMAIN_ROAMINGPROFILE      DESKTOP-HM68BSI
USERNAME                       zejas
USERPROFILE                    C:\Users\zejas
windir                         C:\Windows
> utils::sessionInfo() 
R version 3.5.3 (2019-03-11) 
Platform: x86_64-w64-mingw32/x64 (64-bit) 
Running under: Windows 10 x64 (build 17763)  

Matrix products: default  

locale: [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C                           LC_TIME=English_United States.1252      

attached base packages: [1] stats     graphics  grDevices utils     datasets  methods   base       

other attached packages: [1] nlrx_0.2.0           RevoUtils_11.0.3     RevoUtilsMath_11.0.0  

loaded via a namespace (and not attached):  [1] Rcpp_1.0.1       XML_3.98-1.19    crayon_1.3.4     dplyr_0.8.0.1    assertthat_0.2.1 R6_2.4.0          [7] magrittr_1.5     pillar_1.3.1     miscTools_0.6-22 rlang_0.3.4      rstudioapi_0.10  tools_3.5.3      [13] readr_1.3.1      glue_1.3.1       purrr_0.3.2      hms_0.4.2        compiler_3.5.3   pkgconfig_2.0.2  [19] tidyselect_0.2.5 tibble_2.1.1
>



> results <- run_nl_one(nl, seed=1,siminputrow = 1)
Error loading native library: Unable to load library 'msvcr120': Native library (win32-x86-64/msvcr120.dll) not found in resource path ([file:/C:/Users/zejas/AppData/Roaming/NetLogo/6.1/extensions/r/r.jar, file:/C:/Users/zejas/AppData/Roaming/NetLogo/6.1/extensions/r/jna-4.2.2.jar, file:/C:/Users/zejas/AppData/Roaming/NetLogo/6.1/extensions/r/r.jar])
java.lang.UnsatisfiedLinkError: Unable to load library 'msvcr120': Native library (win32-x86-64/msvcr120.dll) not found in resource path ([file:/C:/Users/zejas/AppData/Roaming/NetLogo/6.1/extensions/r/r.jar, file:/C:/Users/zejas/AppData/Roaming/NetLogo/6.1/extensions/r/jna-4.2.2.jar, file:/C:/Users/zejas/AppData/Roaming/NetLogo/6.1/extensions/r/r.jar])
    at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:277)
    at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:403)
    at com.sun.jna.Library$Handler.<init>(Library.java:147)
    at com.sun.jna.Native.loadLibrary(Native.java:502)
    at com.sun.jna.Native.loadLibrary(Native.java:481)
    at org.nlogo.extension.r.Entry.<clinit>(Entry.java:100)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at org.nlogo.workspace.JarLoader.extensionClassManager(JarLoader.scala:48)
    at org.nlogo.workspace.ExtensionManager.$anonfun$importExtension$8(ExtensionManager.scala:159)
    at scala.Option.getOrElse(Option.scala:138)
    at org.nlogo.workspace.ExtensionManager.importExtension(ExtensionManager.scala:157)
    at org.nlogo.parse.StructureParser$.$anonfun$parsingWithExtensions$1(StructureParser.scala:74)
    at org.nlogo.parse.StructureParser$.$anonfun$parsingWithExtensions$1$adapted(StructureParser.scala:68)
    at scala.collection.immutable.List.foreach(List.scala:392)
    at org.nlogo.parse.StructureParser$.parsingWithExtensions(StructureParser.scala:68)
    at org.nlogo.parse.StructureParser$.parseSources(StructureParser.scala:33)
    at org.nlogo.parse.NetLogoParser.basicParse(NetLogoParser.scala:17)
    at org.nlogo.parse.NetLogoParser.basicParse$(NetLogoParser.scala:15)
    at org.nlogo.parse.FrontEnd$.basicParse(FrontEnd.scala:10)
    at org.nlogo.parse.FrontEndMain.frontEnd(FrontEnd.scala:26)
    at org.nlogo.parse.FrontEndMain.frontEnd$(FrontEnd.scala:25)
    at org.nlogo.parse.FrontEnd$.frontEnd(FrontEnd.scala:10)
    at org.nlogo.compile.CompilerMain$.compile(CompilerMain.scala:43)
    at org.nlogo.compile.Compiler.compileProgram(Compiler.scala:54)
    at org.nlogo.headless.HeadlessModelOpener.openFromModel(HeadlessModelOpener.scala:50)
    at org.nlogo.headless.HeadlessWorkspace.openModel(HeadlessWorkspace.scala:539)
    at org.nlogo.headless.HeadlessWorkspace.open(HeadlessWorkspace.scala:506)
    at org.nlogo.headless.Main$.newWorkspace$1(Main.scala:18)
    at org.nlogo.headless.Main$.runExperiment(Main.scala:21)
    at org.nlogo.headless.Main$.$anonfun$main$1(Main.scala:12)
    at org.nlogo.headless.Main$.$anonfun$main$1$adapted(Main.scala:12)
    at scala.Option.foreach(Option.scala:274)
    at org.nlogo.headless.Main$.main(Main.scala:12)
    at org.nlogo.headless.Main.main(Main.scala)

答案1

当我尝试在 R 中启动模拟时,错误几乎立即产生。

您未能在系统上安装 Microsoft Visual C++ 2013 Redistributable。请确保同时安装 32 位和 64 位版本 我应该指出Visual C++ 2013不兼容二进制,这意味着你必须提供 NetLogo 实际寻找的库的确切版本

适用于 Visual Studio 2013 的 Visual C++ 可再发行组件包

Visual C++ 2013 和 Visual C++ 可再发行组件包的更新

相关内容