PyOpenGL glutInit NullFunctionError

浪尽此生 提交于 2019-11-27 19:25:35
user2723240

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/

Shashanka Prajapati

According to the link below the problem was with the glut installation rather than pip install. It seems glut files are not part of PyOpenGL or PyOpenGL_accelerate package. You have to download them seperately.

https://stackoverflow.com/a/39181193/7030177

Windows user can use the link below to download glut as mentioned in the given link. ftp://ftp.sgi.com/opengl/glut/glut3.html.old#windows

Linux Users can just install glut using the following command:

sudo apt-get install freeglut3-dev

Hope this helps :)

For people on Linux with this error after installing via easy_install PyOpenGL or pip install PyOpenGL.

-> Install the distribution package as: sudo apt-get install python-opengl - this works for me.

If installing PyOpenGL from easy_install, pip or conda, make sure that you have already installed a GLUT implementation, such as FreeGLUT (prebuilt Windows binaries).

For FreeGLUT, copy the distributed files to a location on your hard drive and then add the path to the bin directory (which contains the GLUT DLLs) to your PATH environment variable. Then PyOpenGL should work as expected.

Mamuka Arabuli

for python 2.7, PyopenGL needs vc++ 9 compiler, download and install it.

then:

python -m pip install --upgrade pip

pip install image

pip install numpy

pip install PyOpenGL PyOpenGL_accelerate

I downloaded freeglut

unzipped it and added bin directory to the path when calling: glutCreateWindow("sometitle") changed to glutCreateWindow(b'sometitle')

and got it run on windows 7

Yes, this happened to me on Windows 10 running python 2.713 anaconda 4 64 bit. I had used conda to install pyopengl but received the same error as above. So I downloaded freeglut from transmissionzero and just copied the freeglut.dll (64 bit for me) to the same directory as my source file (it just needs to be in the dll searchpath) and all was good.

I know it is a little late. I also encountered this problem with python 2.7 (32 bits) in windows. I tried the method mentioned by user2723240 but still failed. Finally, 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 now.

I got the same error and a solved installing required files from here.

Download these files:

  • PyOpenGL-3.1.1-cp27-cp27m-win32.whl (download if your computer 32 bits )

  • PyOpenGL-3.1.1-cp27-cp27m-win_amd64.whl (download if your computer 64 bits )

  • PyOpenGL_accelerate-3.1.1-cp27-cp27m-win32.whl (download if your computer 32 bits )

  • PyOpenGL_accelerate-3.1.1-cp27-cp27m-win_amd64.whl (download if your computer 64 bits )

install these .whl files for 64 bits:

pip install PyOpenGL-3.1.1-cp27-cp27m-win_amd64.whl
pip install PyOpenGL_accelerate-3.1.1-cp27-cp27m-win_amd64.whl

install these .whl files for 32 bits:

pip install PyOpenGL-3.1.1-cp27-cp27m-win32.whl 
pip install PyOpenGL_accelerate-3.1.1-cp27-cp27m-win32.whl

On linux, the pyopengl module attempts to use ctypes module to load the glut library as simply 'glut'. According to ctypes documentation the loadLibrary routine must be given the complete filename. Therefore, I made a symbolic link to libglut.so and named it 'glut' and everything just worked.

Mars Carl

My case is different, Python 3.6 and windows 10. However exactly same error message. Tried all above solutions, no success. Downloaded WHL file right to my computer and version of python from HERE

Then pip installs filename.Whl, no more issue!

The answer was from a Chinese website: Answer Link

The folowing should work for Anaconda users:

conda install - c conda-forge freeglut

https://anaconda.org/conda-forge/freeglut

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!