无法使用最新版本的RProvider:R.NET初始化失败

时间:2019-04-05 21:06:55

标签: r f# type-providers

在RProvider中遇到了非常奇怪的行为:

最新版本的RDotNet本身可以正常工作。 较旧的RProvider版本(最高1.1.15版)也不会产生任何问题。 但是任何最新版本(从1.1.17到最新的1.1.22)都会引发以下错误:“ R.NET初始化失败”(即使未导入RProvider模块)。此外,代码的第一行以红色突出显示,并带有以下警告:(“参考程序集RProvider.dll具有程序集级属性TypeProviderAssemblyAttribute,但未找到公共类型提供程序类”)。 深入研究问题后,我发现RProvider日志抱怨缺少R.dll(当然存在)。

[07.04.2019 0:49:22] [Pid:10260, Tid:19, Apid:1] initAndGenerate: starting
[07.04.2019 0:49:22] [Pid:10260, Tid:19, Apid:1] Starting server 'C:\Users\Vat\source\repos\RTest\packages\RProvider.1.1.22\lib\net40\RProvider.Server.exe' with arguments 'RInteropServer_10260_14366875_1958578678 "C:\Users\Vat\AppData\Local\Temp\tmp38A0.tmp"' (exists=true)
[07.04.2019 0:49:22] [Pid:9292, Tid:1, Apid:1] Starting 'RProvider.Server' with arguments '[|"RInteropServer_10260_14366875_1958578678";
"C:\Users\Vat\AppData\Local\Temp\tmp38A0.tmp"|]'
[07.04.2019 0:49:22] [Pid:9292, Tid:1, Apid:1] Registering RInteropServer at channel 'RInteropServer_10260_14366875_1958578678'
[07.04.2019 0:49:22] [Pid:9292, Tid:1, Apid:1] Ready for connections..
[07.04.2019 0:49:22] [Pid:10260, Tid:19, Apid:1] Attempting to connect via IPC
[07.04.2019 0:49:22] [Pid:10260, Tid:19, Apid:1] Got some server
[07.04.2019 0:49:22] [Pid:9292, Tid:5, Apid:1] Attempting resolution for 'RDotNet, Version=1.7.0.0, Culture=neutral, PublicKeyToken=null'
[07.04.2019 0:49:22] [Pid:9292, Tid:1, Apid:1] Waiting for parent process pid=10260 (System.Diagnostics.Process (devenv))
[07.04.2019 0:49:22] [Pid:9292, Tid:1, Apid:1] Server started, running event loop
[07.04.2019 0:49:22] [Pid:9292, Tid:1, Apid:1] server event loop: starting
[07.04.2019 0:49:22] [Pid:9292, Tid:5, Apid:1] Probing locations: C:\Users\Vat\source\repos\RTest\packages\RProvider.1.1.22\lib\net40\..\..\..\..\packages\R.NET.1.7.0\lib\net40;C:\Users\Vat\source\repos\RTest\packages\RProvider.1.1.22\lib\net40\..\..\..\..\packages\R.NET.FSharp.1.7.0\lib\net40;C:\Users\Vat\source\repos\RTest\packages\RProvider.1.1.22\lib\net40\..\..\..\..\packages\RProvider.1.1.22\lib\net40;C:\Users\Vat\source\repos\RTest\packages\RProvider.1.1.22\lib\net40\..\..\..\..\packages\DynamicInterop.0.8.1\lib\netstandard1.2;C:\Users\Vat\source\repos\RTest\packages\RProvider.1.1.22\lib\net40\..\..\..\..\packages\FSharp.Core.4.6.2\lib\net45
[07.04.2019 0:49:22] [Pid:9292, Tid:5, Apid:1] Found assembly, checking version! (C:\Users\Vat\source\repos\RTest\packages\RProvider.1.1.22\lib\net40\..\..\..\..\packages\R.NET.1.7.0\lib\net40\RDotNet.dll)
[07.04.2019 0:49:22] [Pid:9292, Tid:5, Apid:1] ...version matches, returning!
[07.04.2019 0:49:22] [Pid:9292, Tid:5, Apid:1] Attempting resolution for 'DynamicInterop, Version=0.8.1.0, Culture=neutral, PublicKeyToken=null'
[07.04.2019 0:49:22] [Pid:9292, Tid:5, Apid:1] Probing locations: C:\Users\Vat\source\repos\RTest\packages\RProvider.1.1.22\lib\net40\..\..\..\..\packages\R.NET.1.7.0\lib\net40;C:\Users\Vat\source\repos\RTest\packages\RProvider.1.1.22\lib\net40\..\..\..\..\packages\R.NET.FSharp.1.7.0\lib\net40;C:\Users\Vat\source\repos\RTest\packages\RProvider.1.1.22\lib\net40\..\..\..\..\packages\RProvider.1.1.22\lib\net40;C:\Users\Vat\source\repos\RTest\packages\RProvider.1.1.22\lib\net40\..\..\..\..\packages\DynamicInterop.0.8.1\lib\netstandard1.2;C:\Users\Vat\source\repos\RTest\packages\RProvider.1.1.22\lib\net40\..\..\..\..\packages\FSharp.Core.4.6.2\lib\net45
[07.04.2019 0:49:22] [Pid:9292, Tid:5, Apid:1] Found assembly, checking version! (C:\Users\Vat\source\repos\RTest\packages\RProvider.1.1.22\lib\net40\..\..\..\..\packages\DynamicInterop.0.8.1\lib\netstandard1.2\DynamicInterop.dll)
[07.04.2019 0:49:22] [Pid:9292, Tid:5, Apid:1] ...version matches, returning!
[07.04.2019 0:49:22] [Pid:9292, Tid:1, Apid:1] findRHomePath
[07.04.2019 0:49:22] [Pid:9292, Tid:1, Apid:1] getRLocation
[07.04.2019 0:49:22] [Pid:9292, Tid:1, Apid:1] findRHomePath: file='C:\Dev\R\R-3.4.1\bin\x64\R.dll'
[07.04.2019 0:49:22] [Pid:10260, Tid:19, Apid:1] generateTypes: getting packages
[07.04.2019 0:49:22] [Pid:9292, Tid:5, Apid:1] Adding work item to queue
[07.04.2019 0:49:22] [Pid:9292, Tid:1, Apid:1] server event loop: got work item
[07.04.2019 0:49:22] [Pid:9292, Tid:1, Apid:1] eval(.packages(all.available=T))
[07.04.2019 0:49:22] [Pid:9292, Tid:1, Apid:1] engine: Creating and initializing instance (sizeof<IntPtr>=8)
[07.04.2019 0:49:22] [Pid:9292, Tid:1, Apid:1] engine: Creating instance failed:
System.Exception: This 64-bit process failed to load the library C:\Dev\R\R-3.4.1\bin\x64\R.dll. Native error message is 'The system cannot find the file specified'
 at DynamicInterop.UnmanagedDll.ThrowFailedLibraryLoad(String dllFullName, String nativeError)
 at DynamicInterop.UnmanagedDll..ctor(String dllName)
 at RDotNet.REngine..ctor(String id, String dll)
 at RDotNet.REngine.CreateInstance(String id, String dll)
 at RDotNet.REngine.GetInstance(String dll, Boolean initialize, StartupParameter parameter, ICharacterDevice device)
 at RProvider.Internal.RInit.engine@119.Invoke() in C:\FSharp\RProvider\src\RProvider\RInit.fs:line 126
[07.04.2019 0:49:22] [Pid:9292, Tid:1, Apid:1] Output: 
[07.04.2019 0:49:22] [Pid:9292, Tid:1, Apid:1] Operation failed:
System.Exception: Initialization of R.NET failed ---> System.Exception: This 64-bit process failed to load the library C:\Dev\R\R-3.4.1\bin\x64\R.dll. Native error message is 'The system cannot find the file specified'
 at DynamicInterop.UnmanagedDll.ThrowFailedLibraryLoad(String dllFullName, String nativeError)
 at DynamicInterop.UnmanagedDll..ctor(String dllName)
 at RDotNet.REngine..ctor(String id, String dll)
 at RDotNet.REngine.CreateInstance(String id, String dll)
 at RDotNet.REngine.GetInstance(String dll, Boolean initialize, StartupParameter parameter, ICharacterDevice device)
 at RProvider.Internal.RInit.engine@119.Invoke() in C:\FSharp\RProvider\src\RProvider\RInit.fs:line 126
 --- End of inner exception stack trace ---
 at RProvider.Internal.RInit.engine@119.Invoke() in C:\FSharp\RProvider\src\RProvider\RInit.fs:line 137
 at System.Lazy`1.CreateValue()
 at System.Lazy`1.LazyInitValue()
 at RProvider.RInteropInternal.eval@292.Invoke(Unit unitVar0) in C:\FSharp\RProvider\src\RProvider\RInterop.fs:line 293
 at RProvider.Internal.Logging.logWithOutput[a](CharacterDeviceInterceptor characterDevice, FSharpFunc`2 f) in C:\FSharp\RProvider\src\RProvider\Logging.fs:line 57
[07.04.2019 0:49:22] [Pid:10260, Tid:19, Apid:1] RProvider constructor failed: System.Exception: Initialization of R.NET failed ---> System.Exception: This 64-bit process failed to load the library C:\Dev\R\R-3.4.1\bin\x64\R.dll. Native error message is 'The system cannot find the file specified'
 at DynamicInterop.UnmanagedDll.ThrowFailedLibraryLoad(String dllFullName, String nativeError)
 at DynamicInterop.UnmanagedDll..ctor(String dllName)
 at RDotNet.REngine..ctor(String id, String dll)
 at RDotNet.REngine.CreateInstance(String id, String dll)
 at RDotNet.REngine.GetInstance(String dll, Boolean initialize, StartupParameter parameter, ICharacterDevice device)
 at RProvider.Internal.RInit.engine@119.Invoke() in C:\FSharp\RProvider\src\RProvider\RInit.fs:line 126
 --- End of inner exception stack trace ---

Server stack trace: 
 at RProvider.Server.EventLoop.runServerCommandSafe[a](FSharpFunc`2 f) in C:\FSharp\RProvider\src\RProvider\RInteropServer.fs:line 63
 at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
 at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
 at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
 at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
 at RProvider.Internal.IRInteropServer.GetPackages()
 at RProvider.RTypeBuilder.generateTypes@26-2.GenerateNext(IEnumerable`1& next) in C:\FSharp\RProvider\src\RProvider.DesignTime\RTypeBuilder.fs:line 27
 at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()
 at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.System-Collections-IEnumerator-MoveNext()
 at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
 at RProvider.RTypeBuilder.generateTypes@24-1.GenerateNext(IEnumerable`1& next) in C:\FSharp\RProvider\src\RProvider.DesignTime\RTypeBuilder.fs:line 25
 at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()
 at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.System-Collections-IEnumerator-MoveNext()
 at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
 at RProvider.RInteropClient.withServer[a](FSharpFunc`2 f) in C:\FSharp\RProvider\src\RProvider.DesignTime\RInteropClient.fs:line 121
 at RProvider.RTypeBuilder.initAndGenerate@104.GenerateNext(IEnumerable`1& next) in C:\FSharp\RProvider\src\RProvider.DesignTime\RTypeBuilder.fs:line 109
 at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()
 at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.System-Collections-IEnumerator-MoveNext()
 at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
 at RProvider.RProvider.buildTypes() in C:\FSharp\RProvider\src\RProvider.DesignTime\RProvider.fs:line 33

有什么建议吗?因为我真的不喜欢在关键代码中使用过时的库。

因此,当我尝试使用完全相同的RDotNet(1.7.0)版本时,它是RProvider 1.1.22的依赖项,如果我尝试像这样初始化它,则没有任何问题:

engine = REngine.GetInstance()

但是,如果直接指定路径,程序将崩溃,并出现以下异常“此32位进程无法加载库C:\ Dev \ R \ R-3.4.1 \ bin \ x86 \ R.dll。本机错误消息是“系统找不到指定的文件”。如果我使用32位版本的R.dll(bin \ i386 \ R.dll),仍然可以正常工作。

let engine = REngine.GetInstance(@"C:\Dev\R\R-3.4.1\bin\x86\R.dll")

同时,无论我选择哪种体系结构,RProvider 1.1.22都顽固地尝试链接到R.dll的x64版本。

0 个答案:

没有答案