我在macOS Sierra 10.12.2上的VisualStudio Mac Preview 2上使用 NuGet
当我尝试安装 Microsoft CNTK 软件包时:
Microsoft.Research.CNTK.CpuEval-acml 1.5.0
Microsoft.Research.CNTK.CpuEval-mkl 1.7.2
我收到一些错误
Done Building Project "/Users/loretoparisi/Projects/CNTKDemo/CNTKDemo/CNTKDemo.csproj" (restore target(s)) -- FAILED.
Build FAILED.
"/Users/loretoparisi/Projects/CNTKDemo/CNTKDemo/CNTKDemo.csproj" (restore target) (1) ->
(Restore target) ->
/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/xbuild/NuGet.targets : error : Package Microsoft.Research.CNTK.CpuEval-acml 1.5.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.Research.CNTK.CpuEval-acml 1.5.0 supports: net45 (.NETFramework,Version=v4.5) [/Users/loretoparisi/Projects/CNTKDemo/CNTKDemo/CNTKDemo.csproj]
/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/xbuild/NuGet.targets : error : One or more packages are incompatible with .NETCoreApp,Version=v1.0. [/Users/loretoparisi/Projects/CNTKDemo/CNTKDemo/CNTKDemo.csproj]
0 Warning(s)
2 Error(s)
Time Elapsed 00:00:01.57
L'applicazione è stata terminata da un segnale: SIGHUP
Install failed. Rolling back...
Executing nuget actions took 3,48 sec
Unable to restore packages.
[更新]
使用 .NET 控制台项目,可以通过 NuGet 预发布包进行安装CNTK.CPUOnly 2.0.0-beta8
。顺便说一句,运行一个基本示例代码,该代码使用CNTK
[this][1] 等从 CNTK Eval 示例 [here][2] 改编的简单示例会导致异常:
Unhandled Exception:
System.TypeInitializationException: The type initializer for 'CNTK.CNTKLibPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: CNTKLibraryCSBinding
at (wrapper managed-to-native) CNTK.CNTKLibPINVOKE+SWIGExceptionHelper:SWIGRegisterExceptionCallbacks_CNTKLib (CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate)
at CNTK.CNTKLibPINVOKE+SWIGExceptionHelper..cctor () [0x000ee] in <0337cf7b3aa84dd9ab831eb8b7a1f934>:0
--- End of inner exception stack trace ---
at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_generic_class_init (intptr)
at CNTK.CNTKLibPINVOKE..cctor () [0x00000] in <0337cf7b3aa84dd9ab831eb8b7a1f934>:0
--- End of inner exception stack trace ---
at CNTK.DeviceDescriptor.GetCPUDevice () [0x00000] in <0337cf7b3aa84dd9ab831eb8b7a1f934>:0
at CNTK.DeviceDescriptor.get_CPUDevice () [0x00000] in <0337cf7b3aa84dd9ab831eb8b7a1f934>:0
at CNTKDemo.MainClass.Main (System.String[] args) [0x0000b] in /Users/loretoparisi/Documents/Projects/AI/CNTKDemo/CNTKDemo/Program.cs:46
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'CNTK.CNTKLibPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: CNTKLibraryCSBinding
at (wrapper managed-to-native) CNTK.CNTKLibPINVOKE+SWIGExceptionHelper:SWIGRegisterExceptionCallbacks_CNTKLib (CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate)
at CNTK.CNTKLibPINVOKE+SWIGExceptionHelper..cctor () [0x000ee] in <0337cf7b3aa84dd9ab831eb8b7a1f934>:0
--- End of inner exception stack trace ---
at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_generic_class_init (intptr)
at CNTK.CNTKLibPINVOKE..cctor () [0x00000] in <0337cf7b3aa84dd9ab831eb8b7a1f934>:0
--- End of inner exception stack trace ---
at CNTK.DeviceDescriptor.GetCPUDevice () [0x00000] in <0337cf7b3aa84dd9ab831eb8b7a1f934>:0
at CNTK.DeviceDescriptor.get_CPUDevice () [0x00000] in <0337cf7b3aa84dd9ab831eb8b7a1f934>:0
at CNTKDemo.MainClass.Main (System.String[] args) [0x0000b] in /Users/loretoparisi/Documents/Projects/AI/CNTKDemo/CNTKDemo/Program.cs:46
这是由于类型初始化器SWIGExceptionHelper
:
System.TypeInitializationException: The type initializer for 'CNTK.CNTKLibPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: CNTKLibraryCSBinding
- References on CNTK Github:see [here][3].
- Filed a Xamarin Bugzilla [here][4]:
[1]: https://gist.github.com/loretoparisi/61f5c7f8d1a21a7f59771f35c9092de6
[2]: https://github.com/Microsoft/CNTK/blob/master/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/CNTKLibraryCSEvalExamples.cs
[3]: https://github.com/Microsoft/CNTK/issues/1288#issuecomment-272421564
[4]: https://bugzilla.xamarin.com/show_bug.cgi?id=51569