5

After upgrading to ubuntu 14.04 and installing PyOpenGL via pip. It worked fine under ubuntu 12.04, but now I get errors every time I try to use a function from OpenGL.GLUT, e.g. this

from OpenGL.GLUT import *
print bool(glutInit)
glutInit(sys.argv)

will print out "True" and an error message:

File "/usr/local/lib/python2.7/dist-packages/OpenGL/GLUT/special.py", line 333, in glutInit
_base_glutInit( ctypes.byref(count), holder )
File "/usr/local/lib/python2.7/dist-packages/OpenGL/platform/baseplatform.py", line 407, in __call__
self.__name__, self.__name__,
OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling

I don't understand it, any suggestions? Thanks.

Nicor Lengert
  • 188
  • 1
  • 12

4 Answers4

6

It is working after I installed the python opengl package

sudo apt-get install python-opengl

Before that I installed it via pip leading to the error above:

pip install PyOpenGL PyOpenGL_accelerate

I still don't know why, but it is working now.

Nicor Lengert
  • 188
  • 1
  • 12
2

I know it is a little late. I also encounterd this problem with python 2.7 (32 bits ) in windows. I solved this problem by copying glue32.dll to System32 in C drive and copy glue32.dll into my source file directory. It works well.

ccy
  • 1,735
  • 16
  • 19
0

Python 2.7 32bit; Windows 7

This solution works:

After looking around for a solution to a similar problem I ran across this google group that answers the question: https://groups.google.com/forum/#!topic/glumpy-users/aC1NjEHXtEE

There is a problem with OpenGL.GLUT when downloaded as pip from the official source. Uninstall OpenGL using pip, then download OpenGL from http://www.lfd.uci.edu/~gohlke/pythonlibs/

from PyOpenGL glutInit NullFunctionError

Community
  • 1
  • 1
sunshine
  • 21
  • 2
0

I had this issue in Ubuntu 20.04, I was about to try installing the package python3-opengl when I saw the dependency on freeglut3. So I tried installing just freeglut3 with

sudo apt install freeglut3

some python packages required libraries from the system, but it doesn't mean that you need to install the python package in the whole system. Therefore just installing the package within the virtual environment and the dependencies on the system should be enough.