Make EXE compiled with PyInstaller use MSVCRT files in Windows directory

809 views
Skip to first unread message

Johnsons in DE

unread,
Mar 8, 2014, 2:42:31 PM3/8/14
to pyins...@googlegroups.com
I recently switched from py2exe to PyInstaller. My primary reason for doing so was because I found that py2exe cannot embed icons in an executable on my new Windows 8.1 x64 PC. I am impressed by PyInstaller and it definitely seems to be an improvement over py2exe.

In my working with PyInstaller, however, I have encountered an issue. For legal reasons, I cannot bundle the following files in the folder with my application: "Microsoft.VC90.CRT.manifest", "msvcm90.dll", "msvcp90.dll", and "msvcr90.dll". To work around this issue, when I was using py2exe, I ran the Microsoft Visual C++ 2008 Redistributable Setup EXE ("vcredist_x86.exe") available from Microsoft as part of my program's installation process. This installed the MSVCRT files in a subfolder of the Windows directory. I then used a manifest for my EXE which pointed to those MSVCRT files.

I am not exactly sure how to do this with PyInstaller. I discovered that "[ProgramName].exe" will still run even if I delete the 4 MSVCRT files in the application folder. I thought that I might need to modify the "[ProgramName].exe.manifest" file to point to the MSVCRT files in the subfolder of the Windows directory. However, I found the program still ran even if I deleted that manifest file.

Now I am somewhat confused. Is there a manifest embedded in the EXE created by PyInstaller that will use the MSVCRT files in the Windows directory? In other words, how can I accomplish what I want? Is it as simple as deleting the MSVCRT files in the application folder?

Thank you.

-- Timothy

Martin Zibricky

unread,
Mar 10, 2014, 4:46:59 AM3/10/14
to pyins...@googlegroups.com
On Saturday 08 of March 2014 11:42:31 Johnsons in DE wrote:
> I am not exactly sure how to do this with PyInstaller. I discovered that
> "[ProgramName].exe" will still run even if I delete the 4 MSVCRT files in
> the application folder. I thought that I might need to modify the
> "[ProgramName].exe.manifest" file to point to the MSVCRT files in the
> subfolder of the Windows directory. However, I found the program still ran
> even if I deleted that manifest file.
>
> Now I am somewhat confused. Is there a manifest embedded in the EXE created
> by PyInstaller that will use the MSVCRT files in the Windows directory? In
> other words, how can I accomplish what I want? Is it as simple as deleting
> the MSVCRT files in the application folder?
>
> Thank you.


I would have to chek but I think manifest is not embedded in the EXE created
by PyInstaller.

Could it be a manifest that is embedded inside any .dll file that gets bundled?

for example: python.dll?

PyInstaller uses functions CreateActCtx / ActivateActCtx from the
windows api. These functions are related to manifest files and friends.

They could give you insight how pyinstaller works.
signature.asc

Johnsons in DE

unread,
Mar 10, 2014, 1:48:32 PM3/10/14
to pyins...@googlegroups.com
Thank you for your reply. There is indeed a manifest in python27.dll. Now I understand why things worked the way they did when I tried deleting my .exe.manifest file.

I suppose it would be a good idea to keep the .exe.manifest file, even though it's not an absolute necessity? (I would think there must be some good reason why PyInstaller creates it.)

Also, I discovered that the reason py2exe could not embed icons into an EXE on my 64-bit system was because I was using the 32-bit version. I think it would work if I used the 64-bit version (with 64-bit Python). But then I would need to make separate 32-bit and 64-bit builds of my program, which I would prefer not to have to do. This is one of the reasons that I prefer to use PyInstaller. I was wondering, though, if in the future I wanted to build a 64-bit EXE, can PyInstaller do this?

I understand the general differences between 32-bit and 64-bit, such as the different context menu DLLs required. But am I correct that there is no real advantage to using the 64-bit version of Python other than to be able to do complex mathematical calculations faster? (In case it makes a difference, my program has a wxPython GUI, it's not just a console program.)

Thank you.

Martin Zibricky

unread,
Mar 10, 2014, 2:02:48 PM3/10/14
to pyins...@googlegroups.com
On Monday 10 of March 2014 10:48:32 Johnsons in DE wrote:
> I was wondering, though, if in the future I wanted to
> build a 64-bit EXE, can PyInstaller do this?

PyInstaller should do the job. I haven't seen any 64-bit windows specific bug
reports for long time.
signature.asc

Martin Zibricky

unread,
Mar 10, 2014, 2:06:58 PM3/10/14
to pyins...@googlegroups.com
On Monday 10 of March 2014 10:48:32 Johnsons in DE wrote:
> I understand the general differences between 32-bit and 64-bit, such as the
> different context menu DLLs required. But am I correct that there is no
> real advantage to using the 64-bit version of Python other than to be able
> to do complex mathematical calculations faster? (In case it makes a
> difference, my program has a wxPython GUI, it's not just a console
> program.)
>
> Thank you.

My recommendation would be to do 32-bit unless you really need something where
64-bit is inevitable.

Regarding 64-bit Python there might be missing some precompiled Python modules
that your might use.
signature.asc
Reply all
Reply to author
Forward
0 new messages