
Hi All, I tried to build a very simple executable using pyinstaller, where my script just imported clr module. I managed to build the executable but then the executable doesnt run. I have posted the error below. I think the executable is able to find the runtime dll but it is unable to run it. Unhandled Exception: System.IO.FileLoadException: Could not load file or assembl y 'Python.Runtime, Version=4.0.0.1, Culture=neutral, PublicKeyToken=5000fea6cba7 02dd' or one of its dependencies. The located assembly's manifest definition doe s not match the assembly reference. (Exception from HRESULT: 0x80131040) at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String cod eBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntro spection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName as semblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMar k& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIn trospection, Boolean suppressSecurityChecks) at System.Reflection.Assembly.Load(AssemblyName assemblyRef) at clrModule.initclr() I would appreciate any help

Just add path to Python.Runtime.dll in your spec file using "datas" option. I guess pyinstaller only adds clr.pyd. On Tuesday, March 15, 2016, Nikhil Garg <nikhilgarg.gju@gmail.com> wrote:
Hi All,
I tried to build a very simple executable using pyinstaller, where my script just imported clr module. I managed to build the executable but then the executable doesnt run. I have posted the error below. I think the executable is able to find the runtime dll but it is unable to run it.
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembl y 'Python.Runtime, Version=4.0.0.1, Culture=neutral, PublicKeyToken=5000fea6cba7 02dd' or one of its dependencies. The located assembly's manifest definition doe s not match the assembly reference. (Exception from HRESULT: 0x80131040) at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String cod eBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntro spection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName as semblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMar k& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIn trospection, Boolean suppressSecurityChecks) at System.Reflection.Assembly.Load(AssemblyName assemblyRef) at clrModule.initclr()
I would appreciate any help

An pull request was merged to pyinstaller hook for clr (pythonnet): https://github.com/pyinstaller/pyinstaller/pull/2048/files The proper way to use this clr hook is to specify --hidden-import=clr from command-line or hiddenimports=['clr'] in spec file. This should take care of finding Python.Runtime.DLL hidden import for Windows. If anyone is willing to tackle bundling on Linux or OSX, then please go ahead! Note that Mono is not pre-installed on these platforms, hence bundling could get very complicated. Thanks, Denis On Wed, Mar 16, 2016 at 10:15 AM, Denis Akhiyarov <denis.akhiyarov@gmail.com
wrote:
Just add path to Python.Runtime.dll in your spec file using "datas" option. I guess pyinstaller only adds clr.pyd.
On Tuesday, March 15, 2016, Nikhil Garg <nikhilgarg.gju@gmail.com> wrote:
Hi All,
I tried to build a very simple executable using pyinstaller, where my script just imported clr module. I managed to build the executable but then the executable doesnt run. I have posted the error below. I think the executable is able to find the runtime dll but it is unable to run it.
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembl y 'Python.Runtime, Version=4.0.0.1, Culture=neutral, PublicKeyToken=5000fea6cba7 02dd' or one of its dependencies. The located assembly's manifest definition doe s not match the assembly reference. (Exception from HRESULT: 0x80131040) at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String cod eBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntro spection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName as semblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMar k& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIn trospection, Boolean suppressSecurityChecks) at System.Reflection.Assembly.Load(AssemblyName assemblyRef) at clrModule.initclr()
I would appreciate any help
participants (2)
-
Denis Akhiyarov
-
Nikhil Garg