Python 2.6.2, wxPython, and py2exe issues

389 views
Skip to first unread message

blewisjr86

unread,
May 31, 2009, 10:38:57 PM5/31/09
to wxPython-users
Not sure exactly what is going on. I am relatively new to Python,
wxPython and py2exe. Seems py2exe complains that it can't find the
MSVCP90.dll file. I been doing looking all over the net for a
solution to this problem but can't seem to find one other then to run
Python 2.5.4. Can anyone help me out. I don't know what the hell
this winsxs stuff I hear about is.

Mike Driscoll

unread,
Jun 1, 2009, 12:01:09 PM6/1/09
to wxPython-users
Hi,
The winsxs stuff is the new and "improved" way of compiling programs.
Another term for it is Side-by-Side assemblies. There are a couple of
threads in the archives about this.

Werner has written a wiki entry on it:

http://wiki.wxpython.org/py2exe

And you can read about the original issue here (which is supposed to
be fixed with the new 2.8.10.1 release):

http://www.tejerodgers.com/snippets/2009/why-wxpython-crashes-python-26/

Finally, here are a couple of the more recent threads on the issue:

http://groups.google.com/group/wxPython-users/browse_frm/thread/d822b994ca44247d#
http://groups.google.com/group/wxPython-users/browse_frm/thread/b7296dbcea0755ee#

Hopefully one of those will get you going.

- Mike

Bill Lewis Jr

unread,
Jun 1, 2009, 3:45:29 PM6/1/09
to wxPython-users
Hi Mike,

On Jun 1, 12:01 pm, Mike Driscoll <kyoso...@gmail.com> wrote:
> Hi,
>
> On May 31, 9:38 pm, blewisjr86 <blewisj...@gmail.com> wrote:
>
> > Not sure exactly what is going on.  I am relatively new to Python,
> > wxPython and py2exe.  Seems py2exe complains that it can't find the
> > MSVCP90.dll file.  I been doing looking all over the net for a
> > solution to this problem but can't seem to find one other then to run
> > Python 2.5.4.  Can anyone help me out.  I don't know what the hell
> > this winsxs stuff I hear about is.
>
> The winsxs stuff is the new and "improved" way of compiling programs.
> Another term for it is Side-by-Side assemblies. There are a couple of
> threads in the archives about this.
>
> Werner has written a wiki entry on it:
>
> http://wiki.wxpython.org/py2exe
>
> And you can read about the original issue here (which is supposed to
> be fixed with the new 2.8.10.1 release):
>
> http://www.tejerodgers.com/snippets/2009/why-wxpython-crashes-python-26/
>
> Finally, here are a couple of the more recent threads on the issue:
>
> http://groups.google.com/group/wxPython-users/browse_frm/thread/d822b...http://groups.google.com/group/wxPython-users/browse_frm/thread/b7296...
>
> Hopefully one of those will get you going.
>
> - Mike

Those links were very helpful, however, it seems Werner fails to
mention where I get the manifest file on Windows Vista from. I looked
around and under WinSxS folder it seems I have 2 folders with dll's
for the crt.

x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91

and

x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.1_none_e163563597edeada

Then under the Manifests folder I have 2 manifests matching the
folders above.

Not sure which one I should be grabbing the dll's and manifests for.

Mike Driscoll

unread,
Jun 1, 2009, 4:18:25 PM6/1/09
to wxPython-users
Hi,

On Jun 1, 2:45 pm, Bill Lewis Jr <blewisj...@gmail.com> wrote:
> Hi Mike,
>
> On Jun 1, 12:01 pm, Mike Driscoll <kyoso...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > On May 31, 9:38 pm, blewisjr86 <blewisj...@gmail.com> wrote:
>
> > > Not sure exactly what is going on.  I am relatively new to Python,
> > > wxPython and py2exe.  Seems py2exe complains that it can't find the
> > > MSVCP90.dll file.  I been doing looking all over the net for a
> > > solution to this problem but can't seem to find one other then to run
> > > Python 2.5.4.  Can anyone help me out.  I don't know what the hell
> > > this winsxs stuff I hear about is.
>
> > The winsxs stuff is the new and "improved" way of compiling programs.
> > Another term for it is Side-by-Side assemblies. There are a couple of
> > threads in the archives about this.
>
> > Werner has written a wiki entry on it:
>
> >http://wiki.wxpython.org/py2exe
>
> > And you can read about the original issue here (which is supposed to
> > be fixed with the new 2.8.10.1 release):
>
> >http://www.tejerodgers.com/snippets/2009/why-wxpython-crashes-python-26/
>
> > Finally, here are a couple of the more recent threads on the issue:
>
> >http://groups.google.com/group/wxPython-users/browse_frm/thread/d822b......
>
> > Hopefully one of those will get you going.
>
> > - Mike
>
> Those links were very helpful, however, it seems Werner fails to
> mention where I get the manifest file on Windows Vista from.  I looked
> around and under WinSxS folder it seems I have 2 folders with dll's
> for the crt.
>
> x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91
>
> and
>
> x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.1_none_e163563597edeada
>
> Then under the Manifests folder I have 2 manifests matching the
> folders above.
>
> Not sure which one I should be grabbing the dll's and manifests for.

As I understand it, you can use the manifest that comes with Python
2.6 OR you can extract the manifest somehow using ctypes. Robin
mentioned a way of doing that in the archives (not sure if one of my
links included that message or not). However, I am NOT a ctypes guru,
so I can't tell you how to do that.

Werner will hopefully jump in here too and give his two cents worth.
He's actually been playing with Python 2.6 + wxPython whereas I have
not.

- Mike

Bill Lewis Jr

unread,
Jun 1, 2009, 4:44:19 PM6/1/09
to wxPython-users
Hi Mike,
Yea the main problem is the python directory does not contain a
manifest on Vista for some reason.
So I am not sure which manifest I need.

Robin Dunn

unread,
Jun 1, 2009, 6:09:19 PM6/1/09
to wxPytho...@googlegroups.com
Bill Lewis Jr wrote:

> Yea the main problem is the python directory does not contain a
> manifest on Vista for some reason.

It's embedded in the python.exe, which is part of the problem that we've
been trying to deal with. If you have VC++ there is a mt.exe tool that
can extract it, otherwise you can pull it out using win32 APIs (via
ctypes for example.)

--
Robin Dunn
Software Craftsman
http://wxPython.org

blewi...@gmail.com

unread,
Jun 1, 2009, 6:24:20 PM6/1/09
to wxPytho...@googlegroups.com
Robin thx a lot. I happen to have stopped using c++ years ago so I think I will use this as a excuse to learn ctypes through python. Would you happen to know of any good resources off hand? If not thanks for your help anyway much appreciated.
Sent via BlackBerry by AT&T

-----Original Message-----
From: Robin Dunn <ro...@alldunn.com>

Date: Mon, 01 Jun 2009 15:09:19
To: <wxPytho...@googlegroups.com>
Subject: [wxPython-users] Re: Python 2.6.2, wxPython, and py2exe issues

Mike Driscoll

unread,
Jun 1, 2009, 9:22:18 PM6/1/09
to wxPytho...@googlegroups.com
Hi,


On Mon, Jun 1, 2009 at 5:24 PM, <blewi...@gmail.com> wrote:
Robin thx a lot.  I happen to have stopped using c++ years ago so I think I will use this as a excuse to learn ctypes through python. Would you happen to know of any good resources off hand? If not thanks for your help anyway much appreciated.
Sent via BlackBerry by AT&T

Check out the official docs and FAQ:

http://wiki.python.org/moin/ctypes
http://docs.python.org/library/ctypes.html
http://www.python.org/doc/2.5.2/lib/ctypes-ctypes-tutorial.html
http://fsckd.com/2009/4/25/simple-python-ctypes-example/

I think the PyWin32 group also supports ctypes...but it looks like there is a really low-traffice ctypes-specific list here:

https://lists.sourceforge.net/lists/listinfo/ctypes-users

- Mike

Werner F. Bruhin

unread,
Jun 2, 2009, 5:13:42 AM6/2/09
to wxPytho...@googlegroups.com
Bill,

Sorry for getting back into this thread a bit late - was not on the
computer much over the weekend and I am also having ADSL connection
problems.

Bill Lewis Jr wrote:
...


> Those links were very helpful, however, it seems Werner fails to
> mention where I get the manifest file on Windows Vista from.

I was mainly playing around on Windows 7 with Python 2.6.2 (as I wanted
to be 100% sure not to mess up my dev environment), on Win7 (actually on
all Windows versions except Vista) one can install "install for me only"
which then puts the manifest and needed dll's into the Python 2.6
folder, otherwise they will go into the SxS folder.


> I looked
> around and under WinSxS folder it seems I have 2 folders with dll's
> for the crt.
>

The manifest I show on the wiki page is one way of getting it.
> x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91
>
Python 2.6.2 is using the above version ("9.0.21022"), which is the one
I posted on the wiki.
> and
>
> x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.1_none_e163563597edeada
>
You must have something else installed which uses the same dll's but a
newer version.


> Then under the Manifests folder I have 2 manifests matching the
> folders above.
>

I think it is best to use the exactly the same version as Python 2.6
uses, so the 9.0.21022 one.


> Not sure which one I should be grabbing the dll's and manifests for.
>

Will update the wiki page later this week to expand on all this a bit more.

Werner

blewi...@gmail.com

unread,
Jun 2, 2009, 7:08:53 PM6/2/09
to wxPytho...@googlegroups.com
Werner much appreciated no reply is ever too late. Especially if it helps. Looking forward to your wiki update.
Sent via BlackBerry by AT&T

-----Original Message-----
From: "Werner F. Bruhin" <wbr...@gmail.com>

Date: Tue, 02 Jun 2009 11:13:42
To: <wxPytho...@googlegroups.com>
Subject: [wxPython-users] Re: Python 2.6.2, wxPython, and py2exe issues



Stephen M. Gava

unread,
Jun 2, 2009, 8:26:42 PM6/2/09
to wxPytho...@googlegroups.com

Now that the release candidate for python 3.1 is out (and this time they
have osx binary packages, yay), can Robin or anyone comment on when a
build (a prerelease build would be fine) of wxpython for python 3.x will
be available?

Thanks,
Stephen.

Robin Dunn

unread,
Jun 2, 2009, 9:03:24 PM6/2/09
to wxPytho...@googlegroups.com

I'm in the process of putting things in motion for the wxPython 3.x
effort and along the way I plan on doing things that will make it easier
to also have Python 3.x support. I don't think I'll put much effort
into doing them concurrently, (but you never know) so at this point the
best I can say is, "Sometime after wxPython 3.x for Python 2.x is ready."

Stephen M. Gava

unread,
Jun 2, 2009, 9:36:22 PM6/2/09
to wxPytho...@googlegroups.com

Ok, thanks Robin. Btw, you rule at ruling and stuff. ;)

Stephen.

Werner F. Bruhin

unread,
Jun 3, 2009, 6:20:57 AM6/3/09
to wxPytho...@googlegroups.com
blewi...@gmail.com wrote:
> Werner much appreciated no reply is ever too late. Especially if it helps. Looking forward to your wiki update.
>
wiki is updated, let us know if you get things working
Werner

blewi...@gmail.com

unread,
Jun 3, 2009, 8:32:15 AM6/3/09
to wxPytho...@googlegroups.com
Thanks will try it out when I get home from work.
Sent via BlackBerry by AT&T

-----Original Message-----
From: "Werner F. Bruhin" <wbr...@gmail.com>

Date: Wed, 03 Jun 2009 12:20:57
To: <wxPytho...@googlegroups.com>
Subject: [wxPython-users] Re: Python 2.6.2, wxPython, and py2exe issues



Bill Lewis Jr

unread,
Jun 5, 2009, 6:25:29 PM6/5/09
to wxPython-users
Ok I am still having issues and I am not sure why. Apparently py2exe
still can't fine the dll's been working on this for a few days now
everything seems to be coded right in the setup.py here it is.

++++++++++++++++++++++++++++++++++++++

from distutils.core import setup
import os
import py2exe

data = []
# Populate data list
for files in os.listdir('C:/PyMSdlls/'):
tmp1 = 'C:/PyMSdlls/' + files
# Skip if it is a directory
if os.path.isfile(tmp1):
tmp2 = 'Microsoft.VC90.CRT', [tmp1]
data.append(tmp2)

setup(
windows=['SimpleApp.py'],
data_files = data
)

++++++++++++++++++++++++++++++++++++

On Jun 3, 8:32 am, blewisj...@gmail.com wrote:
> Thanks will try it out when I get home from work.
> Sent via BlackBerry by AT&T
>
> -----Original Message-----
> From: "Werner F. Bruhin" <wbru...@gmail.com>
>
> Date: Wed, 03 Jun 2009 12:20:57
> To: <wxPytho...@googlegroups.com>
> Subject: [wxPython-users] Re: Python 2.6.2, wxPython, and py2exe issues
>

Werner F. Bruhin

unread,
Jun 6, 2009, 3:20:32 AM6/6/09
to wxPytho...@googlegroups.com
Bill,

Bill Lewis Jr wrote:
> Ok I am still having issues and I am not sure why. Apparently py2exe
> still can't fine the dll's been working on this for a few days now
> everything seems to be coded right in the setup.py here it is.
>
> ++++++++++++++++++++++++++++++++++++++
>
> from distutils.core import setup
> import os
> import py2exe
>
> data = []
> # Populate data list
> for files in os.listdir('C:/PyMSdlls/'):
> tmp1 = 'C:/PyMSdlls/' + files
>

maybe your slashes?

If you use "glob" this is simpler, see lines 64 to 70 in the py2exe wiki
page.


> # Skip if it is a directory
> if os.path.isfile(tmp1):
> tmp2 = 'Microsoft.VC90.CRT', [tmp1]
>

I think this should be:

tmp2 = ('Microsoft.VC90.CRT', [tmp1])

> data.append(tmp2)
>
> setup(
> windows=['SimpleApp.py'],
> data_files = data
> )
>
>

Werner

Bill Lewis Jr

unread,
Jun 7, 2009, 9:33:53 AM6/7/09
to wxPython-users
Made some changes however still having the same issue. py2exe is
blurting out that it can't fine MSVCP90.dll still.
I am getting to the point where it seems just more logical to
downgrade to python 2.5.4.

+++++++++++++++++++++++++++++++++++++++++++++

from distutils.core import setup
import os
import glob
import py2exe
import zlib
import shutil

shutil.rmtree("build", ignore_errors=True)
shutil.rmtree("dist", ignore_errors=True)

data = []

baseFolder, progFolder = os.path.split(os.getcwd())

pyMSdlls = glob.glob(r"C:\PyMSdlls\*.*")

data += [("Microsoft.VC90.CRT", pyMSdlls),
("lib\Microsoft.VC90.CRT", pyMSdlls),]

setup(
data_files = data,
zipfile = "lib\library.zip",
windows=["SimpleApp.py"]
)


+++++++++++++++++++++++++++++++++++++++++++++

Werner F. Bruhin

unread,
Jun 8, 2009, 6:16:44 AM6/8/09
to wxPytho...@googlegroups.com
Bill,

Bill Lewis Jr wrote:
> Made some changes however still having the same issue. py2exe is
> blurting out that it can't fine MSVCP90.dll still.
>

This happens when you run setup.py py2exe? Or when you try to run the
generated exe?

Does it say where it is looking for it?


> I am getting to the point where it seems just more logical to
> downgrade to python 2.5.4.
>
> +++++++++++++++++++++++++++++++++++++++++++++
>
> from distutils.core import setup
> import os
> import glob
> import py2exe
> import zlib
> import shutil
>
> shutil.rmtree("build", ignore_errors=True)
> shutil.rmtree("dist", ignore_errors=True)
>
> data = []
>
> baseFolder, progFolder = os.path.split(os.getcwd())
>
> pyMSdlls = glob.glob(r"C:\PyMSdlls\*.*")
>
> data += [("Microsoft.VC90.CRT", pyMSdlls),
> ("lib\Microsoft.VC90.CRT", pyMSdlls),]
>
> setup(
> data_files = data,
> zipfile = "lib\library.zip",
> windows=["SimpleApp.py"]
> )
>
>

I am not sure but I think for zipfile to work you should also set the
options "compressed=2" and "bundle_file=3"

Werner

Bill Lewis Jr

unread,
Jun 8, 2009, 9:06:08 PM6/8/09
to wxPython-users
Werner it does not generate anything at all. All it says is Can't
find MSVCP90.dll and the dist directory is empty. It does not mention
where it is looking for it.

Werner F. Bruhin

unread,
Jun 9, 2009, 9:20:19 AM6/9/09
to wxPytho...@googlegroups.com
Bill,

Bill Lewis Jr wrote:
> Werner it does not generate anything at all. All it says is Can't
> find MSVCP90.dll and the dist directory is empty. It does not mention
> where it is looking for it.
>

Then I would guess that you don't have a copy in Python 2.6 folder or
your sxs folder which contains it is not found.

In my py2.6 on Vista folder I have, if IIRC I copied them to that folder.
msvcm90.dll
msvcp90.dll
msvcr90.dll
no ms.vc90 manifest

I also have two copies in "W:\Windows\winsxs" v 21022 and v 30729.

In my py2.6 on Windows 7 folder I have, installed with the option "for
me only":
msvcr90.dll
plus the ms.vc90 manifest

Here again I also have two copies in "W:\Windows\winsxs" v 21022 and v 30729

Werner

Bill Lewis Jr

unread,
Jun 10, 2009, 6:07:08 AM6/10/09
to wxPython-users
Thanks alot Werner. Putting a copy of the dll's into the python DLLS
folder did the trick.

DevPlayer

unread,
Jun 12, 2009, 7:34:41 PM6/12/09
to wxPython-users
Can we put this into a seperate thread? Perhaps with any thread
relating to Google Summer of Code. As I understand someone wants to
refactor the wxpython demo with XRC or some such. I've been playing
with, unsuccessfully, the demo as a learning tool (for python and wx)
at trying to refactor the wxpython demo into a MVP pattern.

Dev Player

Victor Rybynok

unread,
Aug 5, 2009, 3:03:25 PM8/5/09
to wxPython-users
Here are some of my findings regarding deploying wxPython applications
with py2exe on Windows >XP running Python 2.6.2.

= A little introduction =

Microsoft.VC90.CRT assembly includes three dll files: msvcm90.dll,
msvcp90.dll, msvcr90.dll.
Assembly's manifest file includes assembly identification data and
points to the files included into assembly.
In case of Microsoft.VC90.CRT, assembly's manifest file points to the
msvcm90.dll, msvcp90.dll and msvcr90.dll files.
Every exe/dll which dynamically links against some assembly has to
have its own manifest which references that assembly.
In most cases exe/dll manifest is included as a text resource in XML
format.
To find a manifest resource in some exe/dll file, you can just open
that file in any text editor and search for "</assembly>" string (e.g.
look into Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\_core_.pyd
or into Python26\python.exe)
When exe file with manifest is executed, Windows searches for the
referenced assemblies' dlls in executed file's directory and in WINDOWS
\WinSxS.
Python 2.6.2 for win32 is compiled against the Microsoft.VC90.CRT
assembly version="9.0.21022.8".

= Python installation =

When Python 2.6.2 is getting installed "for all users", CRT assembly
is only copied into WINDOWS\WinSxS. No CRT assembly's manifest or dlls
are copied into Python's folder.

When Python 2.6.2 is getting installed "just for me", no CRT assembly
is copied into WINDOWS\WinSxS. CRT assembly's manifest and msvcr90.dll
are copied into Python's folder. Files msvcm90.dll, msvcp90.dll are
not copied there.

Perhaps, the later is an error. All assembly files, pointed by the
Microsoft.VC90.CRT manifest should be included into installation.

The Microsoft.VC90.CRT assembly manifest which is installed into
WINDOWS\WinSxS is different from the assembly manifest installed into
Python's folder. To deploy wxWidgets programs we need
Microsoft.VC90.CRT manifest which is installed into Python's folder.
We also need all msvcm90.dll, msvcp90.dll and msvcr90.dll files.

One of the ways to get all needed Microsoft.VC90.CRT assembly files is
to:
* install Python 2.6.2 with "just for me" option;
* copy Python26\Microsoft.VC90.CRT.manifest to a temporary location;
* uninstall Python 2.6.2 and delete Python26 folder if it was left by
the uninstaller;
* install Python 2.6.2 with "for all users" option;
* copy all files from the WINDOWS\WinSxS
\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375
folder into Python26 folder;
* copy Microsoft.VC90.CRT.manifest file from your temporary location
into Python26 folder.

Now you can install py2exe and wxPython and whatever else your project
requires :)

= Compiling wxPython program with py2exe =

When wxPython program is compiled with py2exe using "bundle_files": 3,
you do not need to add any manifest into your exe, as all required
manifests are included into other dlls (ie pids). Thus, Windows can
find it, and you just need to make sure that Microsoft.VC90.CRT
assembly is installed either into deployed wxPython program on into
WINDOWS\WinSxS.

When wxPython program is compiled with py2exe using "bundle_files": 1
or 2, the manifest has to be included into deployed wxPython program
exe file. The manifest which worked for me with python-2.6.2,
py2exe-0.6.9.win32-py2.6 and wxPython2.8-win32-unicode-2.8.10.1-py26
on Windows XP and Vista 32 and 64 bit, is following:

manifest = '''
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
version="0.6.8.0"
processorArchitecture="x86"
name="MyCare Card Browser"
type="win32"
/>
<description>MyCare Card Browser Program</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"
/>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.VC90.CRT"
version="9.0.21022.8"
processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b"
/>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="x86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
'''

Here again, make sure that Microsoft.VC90.CRT assembly is installed
either into compiled wxPython program directory on into WINDOWS
\WinSxS.

Perhaps, in future more dlls will become parts of some assemblies,
therefore, I think, they should be handled by py2exe automatically.
There also should be a standard "open source" way to install
assemblies into WINDOWS\WinSxS (at least I could not find one,
however, one interesting article to take a look can be found here
http://n2.nabble.com/Tutorial:-How-to-install-files-into-WinSxS-td841475.html)

ps Special thanks to Andrea Gavana, GUI2Exe is a great idea. I hope
this project will survive and prosper ;)

Victor

PYNEWBIE

unread,
Aug 6, 2009, 8:56:01 PM8/6/09
to wxPython-users
Thanks for the analysis this was helpful and added more to my
understanding

Burch
> however, one interesting article to take a look can be found herehttp://n2.nabble.com/Tutorial:-How-to-install-files-into-WinSxS-td841...)
Reply all
Reply to author
Forward
0 new messages