Installing (and Building) PyOpenGL

This document describes the process of installing PyOpenGL 3.x.  Most users should be able to download setuptools .egg files using the easy_install script (the "Standard Install" below).

Dependencies

PyOpenGL has a number of dependencies which need to be installed before installing PyOpenGL.  This list should point you to everything you need to get ready for running PyOpenGL:

Optional PyOpenGL Dependencies:

Note that Togl support is pretty much deprecated, it's there for legacy code (once you compile Togl), but you should likely choose a GUI library that has OpenGL support built-in for any new development.

OpenGLContext dependencies beyond PyOpenGL:

Optional, but generally useful OpenGLContext dependencies:

Standard Install (setuptools/egg based)

The PyOpenGL package uses the "SetupTools" package, which is a common mechanism for distributing and installing Python packages.  It is quite likely that Python developers will already have setuptools installed on their system.  If you do not have it installed, download and run ez_setup.py.  If you want to install your Python egg files in a non-standard location be sure to setup your .pydistutils.cfg to support this before installing the packages.

Note that you may want to uninstall any PyOpenGL 2.x or OpenGL-3.0.0a4 installation before attempting to install. The 3.0.0a4 release used the undecorated name in a misguided attempt to make things "simpler".  The 3.0.0a5 and beyond packages use the same name as all previous PyOpenGL packages, "PyOpenGL".

Once you have setuptools installed (many Python developers already will have it), simply issue the command:

easy_install PyOpenGL

To have setuptools lookup the current version of the PyOpenGL package, download and install it.  If setuptools fails to install the package, you may need to update your setuptools.  Or you can try a direct download of the package with this command in the directory where you downloaded the package:

easy_install -f . PyOpenGL

If you do not have administrative permissions on your machine, you can create a .pydistutils.cfg file in your home directory to tell setuptools where to install new .egg files.

To update your install to the latest release of PyOpenGL:

easy_install -U PyOpenGL

Which will search for the latest registered version of the package and install that on your system.

If you use setuptools to package your application, you should declare a dependency on "PyOpenGL" to pull in the latest PyOpenGL 3.x release.

As of 3.0.0a3 PyOpenGL is dependant on the setuptools package.  You cannot run without the setuptools support, as it is used to provide the plugin mechanism used by array data-type plugin mechanism.  You will probably want to install numpy as well.  ctypes is a dependency for Python 2.4 and Python 2.3 but included with Python 2.5.

Source Install

If (for whatever reason) you would like to install from the source distribution you can do so.  To accomplish the install you will need setuptools installed (see standard installation above).  When that is in place, download and unpack the .tar.gz or .zip file and run the following command:

python setup.py install

CVS Install

If you are working in an area that's currently under active development you may prefer to use the CVS version of the PyOpenGL package.  OpenGL-ctypes (the code-name for the 3.0.0 version of PyOpenGL) is developed and maintained within the PyOpenGL CVS repository.  To check out the current version of OpenGL-ctypes:

cvs -z3 -d:pserver:anonymous@pyopengl.cvs.sourceforge.net:/cvsroot/pyopengl co -P OpenGL-ctypes

You can install the checkout to your path for further development as follows (from the OpenGL-ctypes checkout directory):

./setupegg.py develop --install-dir=~/YOUR-WORKING-DIRECTORY-ON-PYTHONPATH-HERE

When you make a change, run cvs diff on the OpenGL-ctypes directory to produce a patch file and upload it to the SourceForge patch tracker. I prefer "context" diffs (cvs diff -c) for contributed code, as it makes it easier to see where the code fits in.  That said, I'm happy to get code in any readily integrated format.

Building Documentation

Building the documentation-set from source uses Java-based DocBook processing scripts, so it can take quite a bit of work to set up properly.  Most developers will never need to do this, but future administrators (such as myself) will likely want some instructions.  Here's the steps.

catalogs=catalog.xml
relative-catalogs=true
static-catalog=yes
verbosity=1
<public publicId="-//W3C//DTD MathML 2.0//EN"
uri="mathml/mathml2.dtd"/>
<public publicId="-//W3C//ENTITIES MathML 2.0 Qualified Names 1.0//EN"
uri="mathml/mathml2-qname-1.mod"/>
<public publicId="-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
uri="mathml/xhtml-math11-f.dtd"/>
<public publicId="-//OASIS//DTD DocBook XML V4.1.2//EN"
uri="docbookx.dtd"/>

Note that the HTML-help feature is not likely to work with the new javascript+CSS formatting provided by the MathML stylesheets above.  Expect the results to be either unreadable or simply fail to be generated.

Building Older Releases

If you would like to build the 2.x release of PyOpenGL, you can view the original installation documentation.