Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to point pyinstaller to the right versions of MSVC?90.dll?

I have a python application that I am trying to build as a pyinstaller distributable. A similar script builds successfully on Linux.

I am building it on Windows 7 x64, but want to build 32-bit binary for better compatibility, so I am using 32-bit python-2.7. Among my dependencies are matplotlib and pyside which require MSVC. I install a package called VCForPython27 from Microsoft.

I run into an error when I run my pyinstaller script. I get the following message:

1250 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final executable
7428 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none ...
7428 WARNING: Assembly not found
7428 ERROR: Assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none not found
7475 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\python.exe
7553 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none ...
7553 WARNING: Assembly not found
7553 ERROR: Assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none not found
7662 WARNING: lib not found: MSVCR90.dll dependency of C:\Windows\system32\python27.dll
7662 INFO: Analyzing C:\Python27\lib\site-packages\PyInstaller\loader\_pyi_boots

There are multiple messages like that about both the files MSVCP90.dll and MSVCR90.dll

I can see that I have a folder C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_5090ab56bcba71c2 that contains versions of both files.

This mismatch occurs both when I install my python packages from Christoph Gohlke's page and with pip (except for matplotlib, which I can't install with pip because of missing dependencies).

Strangely enough pyinstaller makes a binary. Yet, when I try to run it I get a popup saying:

WARNING: file already exists but should not:
C:\Users\Martin\AppData\Local\Temp\_MEI34922\Include\pyconfig.h

Does anyone know how I can do any of the following:

  1. Install the precious x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none assembly? Where can I take this specific version from?
  2. Tell python to look for the other version (x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_5090ab56bcba71c2)?
  3. Solve the pyconfig.h unwanted presence issue? Doesn't seem to lead anywhere, but I thought I should try it too.
  4. Find another way to build my code to a binary? It's a complicated code, running external binaries, but if I have to I will try py2exe, not sure that it would be any better though.
like image 318
mapto Avatar asked Oct 18 '14 20:10

mapto


People also ask

How to install msvcr90 DLL on Windows?

First of all, you need to download Msvcr90.dll to PC from our site. Copy the file to the program install directory after where it is missing the DLL file. Or move the DLL file to the directory of your System (C:\Windows\System32, and for a 64 bit in C:\Windows\SysWOW64\).

How do I get the version of an object in pyinstaller?

Or you can apply the unicode () function to the object to reproduce the version text file. Under macOS, PyInstaller always builds a UNIX executable in dist . If you specify --onedir, the output is a folder named myscript containing supporting files and an executable named myscript .

How do I use pyinstaller with venv?

Use venv to create as many different development environments as you need, each with its unique combination of Python and installed packages. Install PyInstaller in each virtual environment. Use PyInstaller to build your application in each virtual environment. Note that when using venv, the path to the PyInstaller commands is:

How do I use pyinstaller?

The PyInstaller workflow can be summed up by doing the following: Create an entry-point script that calls your main function. Install PyInstaller. Run PyInstaller on your entry-point. Test your new executable. Ship your resulting dist/ folder to users.


1 Answers

The redistributable package that contains version 9.0.21022.8 of msvcr90.dll and msvcp90.dll can be downloaded from the Microsoft website here. This will help PyInstaller to find the versions it wants and include them with the resulting executable.

Interestingly enough, I'm able to run the executable compiled by PyInstaller with redistributable version 9.0.30729.6161 installed, it just won't package these dlls. I tried to copy the msvc*90.dll's into the dist directory, even tried creating and modifying manifest files, but I would still get an error from python27.dll in the end. Installing any version of VC++ redistributable would fix the issue, but then my package wouldn't be self-containing. I wish I understood what exactly is going on here better...

like image 102
dkobozev Avatar answered Sep 23 '22 00:09

dkobozev