Using the PyGTK All-in-one installer
The PyGTK All-in-one version number
The PyGTK All-in-one installers' version number does not map directly to the PyGTK version number, simply because the PyGTK All-in-one installer is a repackaging of multiple components where each component may receive updates in the form of a new PyGTK All-in-one installer revision release. It is also a requirement to support windows installer major upgrades. The version number is constructed as follows:
What file should I use?
All the .msi files are named as follows:
Where X.X.X is the PyGTK All-in-one version number, YY is 32 or 64 and Z.Z is the Python version number the installer supports. Currently, only 32 bit Python is supported (on both 32 and 64 bit Windows).
You need to make sure both YY and Z.Z correspond to the version of the Python interpreter that's installed on your system.
I'm new, how do I start?
First, you'll need to install a 32 bit Python interpreter. Currently, you can choose between Python 2.6 and Python 2.7.
Then you install the PyGTK All-in-one version that matches the Python version you choose above. It's that easy!
Migrating from PyGTK+PyGObject+PyCairo packages
If you have used some or all of the separate PyGTK, PyGObject, PyGooCanvas, PyGtkSourceView2, PyRsvg and PyCairo packages before, please ensure they are uninstalled before you begin with the PyGTK All-in-one installer.
The all-in-one installer does not check for their presence and will happily overwrite files that belong to the separate packages. If you forget to check for this you risk the following scenario:
- install Python
- install PyCairo, PyGTK and PyGObject
- install PyGTK All-in-one
- uninstall PyCairo, PyGTK and PyGObject
- you now have a broken pygtk all-in-one installation
This would also be a good time to remove the GTK+ runtime you've used with the separate PyG* packages and to clean your PATH environment variable.
Note that the PyCaio, PyGObject, PyGTK, PyGoocanvas, PyGtkSourceView2 and PyRsvg .exe installers (like any other .exe installer generated by distutils) sometimes leave things behind when you uninstall them.
A default PyGTK All-in-one installation automatically detects the correct Python installation directory and if Python was installed for all users or just yourself. These values are then used by the PyGTK All-in-one installer. To start a default PyGTK All-in-one installation, simply double click the .msi file or execute the following command from a Command Prompt (cmd.exe):
%WINDIR%\system32\msiexec.exe /i pygtk-all-in-one-X.X.X.winYY-pyZ.Z.msi
Like any other Windows Installer package, you can change how PyGTK All-in-one will be installed on you system by passing parameters (setting public properties for those familiar with windows installer). Execute %WINDIR%system32msiexec /help for a list of options supported for all .msi installation packages.
The TARGETDIR property determines the root directory of the PyGTK All-in-one installation. If this property is set, the PyGTK All-in-one installer does not automatically detect the installation directory of the Python interpreter installed on you system. For example, a custom installation directory can be specified with:
Before you set a custom TARGETDIR property, you need to make sure both python.exe and pythonw.exe exist in that directory or the installation will fail.
Installation for All Users
The ALLUSERS property determines if PyGTK All-in-one should be installed for all users, or only for the user that initiated the installation. If you want to install for all users, set the ALLUSERS property to "1":
If you want to install for the current user only, you should not specify the ALLUSERS property at all. Hence, a per user installation is the default installation mode for custom installations. Note that "1" is the only valid value for the ALLUSERS property!
You need to combine this property with the TARGETDIR property. Setting ALLUSERS disables the automatic Python interpreter detection.
The INSTALLLEVEL property determines what features are going to be installed. If the INSTALLLEVEL property is not set, its value defaults to 1 which causes a basic set of features to be installed (GTK+ runtime, PyGTK, PyGObject and PyCairo)
If you set INSTALLLEVEL to 2 (or any number greater than 2), you instruct the installer to do a "complete" installation (all features will be installed).
There is another method to control what features should be installed by controlling the ADDLOCAL, REMOVE, ADDDEFAULT, REINSTALL, etc properties. Check MSDN for more details.
Other msiexec options
Take note that if the PyGTK All-in-one installer is run with no or a basic UI (/q[n|b]) the automatic Python installation detection is skipped. In this case setting the TARGETDIR property is required. You can also set the ALLUSERS property if you want a system wide installation.
The PATH environment variable
The PyGTK All-in-one installer does not require you to fiddle with the PATH environment variable. The PyGTK version that's installed with the all-in-one installer takes care of loading the bundled GTK+ runtime on the PATH environment variable on interpreter startup. As a consequence simply importing gobject, gtk, etc works out of the box. And as an added advantage there is no possible way multiple GTK+ runtime versions on your system or user PATH environment variable can interfere with PyGTK All-in-one.
If something doesn't work as expected, you'll need to generate a couple of log files before you'll be able to get help. It is simply impossible to determine why something went wrong without these log files.
If something went wrong when installing, you'll need both:
An installation log (install.log). Execute the following command from a Command Prompt (cmd.exe):%WINDIR%\system32\msiexec.exe /i pygtk-all-in-one-X.X.X.winYY-pyZ.Z.msi /l*vx install.log
An execution log (import.log). Execute the following command from a Command Prompt (cmd.exe):python -v -c "import gtk">import.log 2>&1
If something went wrong when uninstalling, you'll need an unistall log. Execute the following command from a Command Prompt (cmd.exe):
%WINDIR%\system32\msiexec.exe /x pygtk-all-in-one-X.X.X.winYY-pyZ.Z.msi /l*vx uninstall.log
Please consider compressing the log files you obtained before you send them by mail or attach them to a bug report. Those files can be quite large. If you do not have a compression program yet, 7-Zip from http://www.7-zip.org/ is a good choice.
In theory, Windows 2000 should be supported, but in practice the gtk+ binaries on ftp.gnome.org are affected by libgio-2.0-0.dll needing the freeaddrinfo() function which is only available starting from Windows XP:
When/if the above get's fixed, you would still need to install gdiplus.dll:
- Download the GDI+ Platform SDK redistributable from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6a63ab9c-df12-4d41-933c-be590feaa05a&displaylang=en
- Execute the downloaded WindowsXP-KB975337-x86-ENU.exe and it will ask to extract some files.
- Copy the extracted asms\10\msft\windows\gdiplus\gdiplus.dll file to C:\Python2X\Lib\site-packages\gtk-2.0\runtime\bin
About the pygtk-installer project
The pygtk-installer project provides a set of tools to build the PyGTK All-in-one installer and its various dependencies. There are currently versions of the PyGTK All-in-one installer supporting 32 bit versions of Python 2.6 and Python 2.7.
- build_bindings.sh: a tool that builds windows installer packages (both .exe and .msi) for pycairo, pygobject, pygtk, pygoocanvas, pygtksourceview and pyrsvg for each supported Python version.
- build_installer.py: a tool that generates the all-in-one installer bundling the separate .msi installers created by build_bindings.sh and various GTK+ runtime packages from ftp.gnome.org/pub/GNOME/binaries/win32/.
For more information on using these tools, refer to the doc/HACKING.rst file.