Retaining question for posterity; see workaround in edit
The Pyglet package comes installed at base and isn't removable. Using the current fully updated version 1.1.4 of Pyglet, I get repeatable errors related to importing the item pyglet.gl.gl_info
; for instance, upon attempting to create a pyglet.window.Window()
, upon trying to import pyglet.gl
, or upon attempting to import pygarrayimage via from pygarrayimage.arrayimage import ArrayInterfaceImage
.
In all such cases the relevant traceback ends with the uninformative message:
/Users/[username]/Library/Enthought/Canopy_64bit/System/lib/python2.7/site-packages/pyglet/image/__init__.py in <module>()
142
143 from pyglet import gl
--> 144 from pyglet.gl import *
145 from pyglet.gl import gl_info
146 from pyglet import graphics
/Users/[username]/Library/Enthought/Canopy_64bit/System/lib/python2.7/site-packages/pyglet/gl/__init__.py in <module>()
102 from pyglet.gl.glext_arb import *
103 from pyglet.gl.glext_missing import *
--> 104 from pyglet.gl import gl_info
105
106 import sys as _sys
ImportError: cannot import name gl_info
I am using OSX 10.6.8 on an Intel processor, with Canopy 64-bit, and these are 100% repeatable.
Given the traceback one might assume gl_info
mistakenly isn't included, but this isn't the case. dir(pyglet.gl.gl_info)
can successfully be run.
Edit: Solved this problem.
Pyglet 1.1.4 does not support 64-bit on OSX, so until Enthought packages a newer release of Pyglet in Canopy, here is a workaround for 64-bit OSX users.
- Acquire source for any release of Pyglet 1.2alpha1 or beyond.
- Extract source to your directory of choice.
- Append this directory to the beginning of your PYTHONPATH environment variable, in both
~/.bash_profile
(for terminal shells) and/etc/launchd.conf
(for GUI processes) with a line similar to:export PYTHONPATH=/Users/[username]/src/pyglet-1.2alpha1:$PYTHONPATH
- Run this bash command in an unrelated directory and confirm the path printed leads to your 1.2alpha1 source directory:
$ python -c "import pyglet; print pyglet.__path__[0]"