PyOpenGL: I recently came across the following error while building PyOGL on RH9.0 under both Python 2.2 and 2.3.2 warning: error while loading Togl.so: can't find package Tk 8.1 'setup.py build' worked fine, I only saw this error upon running 'setup.py install'. I'm running Tk8.3, so I don't know why it's looking for 8.1. I've built PyOGL on Mac OS X/fink and RH8.0 and have never before seen this problem. I googled the error and found a couple of other occurances of this error (e.g. here), but no suggested work arounds.
Got a response to this from Mike Fletcher, who referred me to this web page, where Craig Kaplan posts the following:
One of your brave fellow students provided her laptop in what
proved to be a successful PyOpenGL linux building experience.
Here are some simple instructions. They should work for, say,
RedHat 8/9 and Python 2.2 or 2.3. I'll assume you're using
Python2.2 for these instructions -- the substitutions for 2.3
should be obvious.
1. tar xzvf PyOpenGL-2.0.1.07.tar.gz
cd PyOpenGL-2.0.1.07
python setup.py install
At this point we'll get to that mysterious "can't find Tcl 8.1"
error that some of you have experienced. But a lot of the
files we need have already been installed.
4. Edit the file "setup/togl_setup.py". Look for the lines
# make package index for tcl/tk
if not dry_run:
Change "if not dry_run:" to "if 0:" to disable the block of
code that follows.
5. Edit the file
"/usr/lib/python2.2/site-packages/OpenGL/Tk/linux2-tk8.3/pkgIndex.tcl"
(the name may be slightly different for you). Add the following lines
to the end of it:
------------ CUT HERE --------------
if {![package vsatisfies [package provide Tcl] 8]} {return}
package ifneeded Togl 1.6.0 \
[list load [file join $dir Togl.so] Togl]
------------ CUT HERE --------------
6. Go back to the PyOpenGL-2.0.1.07 directory and re-run
"python setup.py install". This time the installation should
run until the end.
7. Don't try to test that it works from within the PyOpenGL
source directory -- it fails for some reason. Switch to
a different directory and try "from OpenGL.Tk import *"
from within a Python session. You shouldn't get any errors,
and a small window should appear on the screen.
