I recently went and compiled my Tkinter application into a standalone app using py2exe. It seems to work when python is installed on the computer but when it is not installed, it shows the error - 'This application is not configured properly. Reinstalling the application may help', I read elsewhere that downgrading to python 2.5 solves this problem, but I cant, cause python 2.5 contains Tkinter 8.4 which makes my application look like crap. Please help me to solve this problem.

-vishy1618

I recently went and compiled my Tkinter application into a standalone app using py2exe. It seems to work when python is installed on the computer but when it is not installed, it shows the error - 'This application is not configured properly. Reinstalling the application may help', I read elsewhere that downgrading to python 2.5 solves this problem, but I cant, cause python 2.5 contains Tkinter 8.4 which makes my application look like crap. Please help me to solve this problem.

-vishy1618

This is purely down to .dll's. Namely the msvcrXX runtimes (msvcr70.dll, msvcr90.dll etc)

If the target machine does not have Python installed, then it needs to have the correct version of the Microsoft VC runtime installed (depending on the version of python used). I'm pretty certain it's the VC9 redistributable runtime package (msvcr90.dll) that you need to include/install in order for apps created with the Python2.6 version of py2exe to work.

The reason for this is because python2.6 was built against the msvcr90.dll, so python 2.6 depends upon the msvcr90.dll...It needs it.

Therefore, when packaging up your app ready for deployment to users, you'll need to ensure that you include the installer for the msvc90 redistributable runtime in case the users machine does not already have it (which in this case your test pc sounds like it doesn't!).

If python 2.6 is installed on your users pc (or any other app that requires the msvc90 runtime), then the msvcr90 runtime will already be installed on the machine, so your app created by py2exe will run with no problems.

Whereas if there is an earlier version of Python or no Python at all, and if there are no other apps installed which use the msvcr90.dll, then your program will fail in the manner you've already described.

As mentioned previously, to fix the issue, you need to ensure you either include a copy of the msvc90.dll in your distribution folder before creating your installer, or better still - include the official microsoft redistributable install package in your final installer package. Perhaps making it an optional component to install, or perhaps you could use a script to see whether it is installed already and automatically install it if it is not.

Either way, that will ensure that your users are able to install and use your app without any problems, regardless of whether or not Python 2.6 is installed.

So to sum up...you need the VC9 runtime on your test PC!

Try it, download and install the msvcr90 runtime on your test PC and then try running your py2exe app!

The reason Python2.5 works is because it uses the msvcr70 runtime package and the msvcr70.dll was automatically included in the distribution folder by py2exe for Python2.5.
In fact, even if you explicitly excluded the msvcr70 runtime from your py2exe build, the chances are that your app would still work as the majority of windows PC's would already have the msvcr70 runtime installed by default!

I hope this clears things up for you!
Cheers for now,
Jas.

Comments
very detailed explanation

JasonHippy: Thank you for your prompt and precise reply. I'll check if msvcr90.dll is the problem or not. Even when I uninstall Python from the computer, the standalone app does not seem to work. Another thing: will this msvcr90.dll make my application proprietary? Are there redistribution restrictions? Cause, I've licensed my app under GPLv3.
Anyways, thanks, this community is definitely great.

Runtime versions (in your case msvcr90.dll) of the Microsoft C compiler have to be shipped with any program that has been compiled with it. Since Python26.dll has been compiled with this version, the appropriate runtime version can be included without problems. In the matter of fact, your Python 2.6 Windows binary distribution had to include it to work on your machine.

OK, I included msvcrt90.dll in the dist folder but it does not solve the problem. Googling around, I find that there are a lot of similar problems cropping up. I think it is because of msvcrt90.dll...the python26.dll does not seem to find the vc dll. I dont know much about DLL problem fixing. If you guys find something please let me know.
N.B.: Try this: compile a simple tkinter app with py2exe, bundle msvcrt90.dll and test it on a machine not having python. This should be compiled using Python 2.6.2, that is what seems to be "tainted".

OK, I think I solved it, I just installed vc redistributable package from MS, and the application started working without python installed. Installing the application makes msvcrt90.dll globally available and hence solves the problem. But it still sucks asking everyone to install the vc package.

Comments
Thanks for the info

OK, I think I solved it, I just installed vc redistributable package from MS, and the application started working without python installed. Installing the application makes msvcrt90.dll globally available and hence solves the problem. But it still sucks asking everyone to install the vc package.

Welcome to .dll hell....One of the few things that Microsoft really did create entirely themselves, heh heh! And yes it does suck! ;)

Not everybody who uses your app would have to install the MSVC redistributable....Just anybody who didn't already have it installed. But as you've got no way of knowing, what proportion of your users already have it against the proportion that don't, your best bet is to just bite the bullet and cover all bases by including the MSVCRT redistributable with your apps install package!

I have the same problem but I can't solve it!!
Can someone help me?
I had copy the MSVC90.dll (the right version) into the dist folder, but that don't solve the problem. Take a look at my setup.py:

# -*- coding: cp1252 -*-
from distutils.core import setup
import py2exe
import os
import pygame
import sys

data_files = [('images', ['images\Bolita.png','images\Reiniciar.png','images\Vaso.png','images\setup.png','images\Tercio.png','images\Bolita.png']),
             ]
			 
#####################################################
# py2exe solution for pygame.font module
#This will make sure that the SDL_ttf.dll isn't recognized as a system dll.
#####################################################
origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
       if os.path.basename(pathname).lower() in ["sdl_ttf.dll"]:
               return 0
       return origIsSystemDLL(pathname)
py2exe.build_exe.isSystemDLL = isSystemDLL
#####################################################

setup(
    data_files = data_files,
    windows = [{"script":"Tercio.py"}]
    )

I'm using python 2.6.5, pygame-1.9.1.win32-py2.6, py2exe-0.6.9.win32-py2.6
I'm getting crazy with this error, please help!

I tryed with python 2.5.4, pygame-1.9.1.win32-py2.5, py2exe-0.6.9.win32-py2.5
And the same problem... :S

This article has been dead for over six months. Start a new discussion instead.