Search code examples
pythonopenglpippyopengl

PyOpenGL-3.1.5-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform


For a Python project I need PyOpenGL. I have installed it with the PyCharm IDE.

When I ran an OpenGL program to test the installation, the following error message came up:

OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling.

I searched in the www for possible solutions and I've found some at StackOverflow. I tried all of them and none worked.

Then I've found that blog here:

https://block.arch.ethz.ch/blog/2016/10/pyopengl-glut-error/

I followed all instructions and got the following error-message in PyCharm IDE:

(virtual-environment) C:\Users\Rainer\PycharmProjects\MatchMover>pip install C:\Users\Rainer\Desktop\PyOpenGL-3.1.5-cp36-cp36m-win_amd64.whl
PyOpenGL-3.1.5-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.
You are using pip version 9.0.1, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

The pip package has already been updated to the version 20.0.2 manually, but is not in sync with PyCharm IDE.

I'm using a Windows 7 computer, Python 3.6.3, PyOpenGL-3.1.5-cp36-cp36m-win_amd64.whl and as OpenGL-library I use freeglut.

Here is the test program (taken from: https://codeloop.org/python-opengl-programming-creating-window/):

main.py

from OpenGL.GL import *
from OpenGL.GLUT import *

width, height = 500, 400 

def draw():
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
    glLoadIdentity()

    glutSwapBuffers()


glutInit()
glutInitDisplayMode(GLUT_RGBA )
glutInitWindowSize(width, height)
glutInitWindowPosition(200, 200)
window = glutCreateWindow("Opengl Window In Python")
glutDisplayFunc(draw)
glutIdleFunc(draw)
glutMainLoop()

Solution

  • Two common sources of this error are that…

    1. the package expects a different system type (32-bit vs 64-bit).
    2. system doesn’t have or can’t identify the necessary version of Python i.e. someone only have a 3.x version installed, but the package requires Python 2.7.

    But as you stated that, you have python 3.6 so I will put solution for first option.

    The fix is either to download the other version (32-bit if you downloaded 64-bit and vice versa) or change the wheel’s file name if you know you need the version you have.