6

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.

5 Answers 5

7

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.

Sign up to request clarification or add additional context in comments.

Comments

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.

1 Comment

Well, now we have "solutions" for linux and windows. ;)
1

Worked for me on Ubuntu 22.

sudo apt-get install -y python3-opengl

Comments

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

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.