0

Man I am exhausted...I am running python 2.7 and have created an application with wxPython. When attempting to create and .exe with py2app, I get the following error:

error: [Errno 2] No such file or directory: 'MSVCP90.dll'

I have read tons of posts that say that the addition of this file into my into my c:\python27\DLLs directory will do the trick. Unfortunately, I have done that and the error remains. Any help would be appreciated.

BPoy
  • 159
  • 2
  • 11

2 Answers2

1

My few cents:

  • Use PyInstaller. Advantages: Will work without further ado for wxPython. Actively developed, has recipes AKA hook files for almost every library, even for the hard ones. Disadvantage: does not rely on distutils/setuptools, so if there is no recipe for your (non-pure python) library, you have to deal with the non-python dependencies yourself (distutils/setuptools recipes do not work).
  • For py2exe (I suppose this is what you are talking about): You cannot just simply copy the DLL over, you have to use a manifest file. Check this wxPython-wiki entry to see what this all is about. Furthermore you have to deal with the distribution of the DLL yourself (by either installing Python 2.7 on the target machine, installing the runtime distributable from Microsoft yourself on the target machine or use a helper library like Esky, which can be configured to include the manifest and care for copying of the DLL itself).
nepix32
  • 3,012
  • 2
  • 14
  • 29
  • Thanks for the information. I will give pyInstaller a try. What do you mean by 'non-pure python' library? Can you give me an example. – BPoy Sep 12 '14 at 11:44
  • e.g `wxPython` is a non-pure python library (consists of *.py files and has binary dependencies, which is `wxwidgets`). However, there is a hook file for `wxPython` in PyInstaller, so you do not need to worry about these. – nepix32 Sep 12 '14 at 12:08
  • I don't think the manifest file is an issue any more. That happened with Python 2.6 due to the version of Visual Studio used. It was my understanding that this issue went away in 2.7. – Mike Driscoll Sep 12 '14 at 13:08
  • See e. g. [cx_Freeze docs](http://cx-freeze.readthedocs.org/en/latest/faq.html#microsoft-visual-c-redistributable-package). I am no expert on this, but the manifest is generally needed according Microsoft to allow side-by-side installation of DLLs with the same name, but different internal versions (managing DLL hell). This mechanism is called WinSxS, where the different DLL versions end up living. ´This should be required for all Pythons from 2.6 to 3.2 (which are based on VS 2008). – nepix32 Sep 12 '14 at 13:31
  • I tried pyinstaller. It was very easy. I am going to give up on py2exe. – BPoy Sep 13 '14 at 13:28
1

Distributing the MSVCP90.DLL file is a different issue. What the OP faces is that py2exe cannot find the MSVCP90.DLL file when BUILDING the exe.

The solution is to put MSVCR90.DLL on the dll_excludes list, either by changing the setup.py file, or by passing it on the command line like this:

python setup.py py2exe --dll-excludes=MSVCP90.DLL

theller
  • 2,809
  • 19
  • 19
  • That is of course correct. But it is only the first step of the solution. While the EXE created by py2exe will run happily on the developer machine (because at least Python 2.7 has already taken care of the DLL), a target machine (without Python 2.7 or VS2008) will usually not have the DLL. – nepix32 Sep 12 '14 at 18:29
  • `>> I got a --dll_excludes not recongnized error` Sorry for that typo: --dll-excludes instead of --dll_excludes – theller Sep 12 '14 at 19:05