1
votes

I am trying to learn 3d by following thenewboston on you tube. I got the

import OpenGL

to work, but then when he types in

from OpenGL.GLU import *

it does not work. I noticed that I had a folder named OpenGL inside the OpenGL folder. So I changed the one inside to GL. I typed in

from OpenGL.GL.GLU import *

and it still did not work. It is giving me this error.

File "C:\Python34\OpenGL\GL\__init__.py", line 174, in <module>
    from OpenGL.version import __version__
ImportError: No module named 'OpenGL.version'

I looked this up and on another thread here on stackoverflow, it said to use setup tools and enter the command directory of easyinstall. I have pip and setup tools installed along with opengl of course. I entered in my directery into cmd as

C:\Python34\setuptools\easy_install pyopengl

It then gave me this error.

Traceback (most recent call last):
  File "C:\Python34\setuptools\eas
    from setuptools.command.easy_i
  File "C:\Python34\setuptools\set
    from six.moves import filter,
ImportError: No module named 'six'

Here is my code at the start.

import pygame
from pygame.locals import *
import OpenGL
from OpenGL.GL.GLU import *
import pip
import setuptools

If anyone knows what I can do that would be very helpful. Thank you for your time and effort in solving this problem.

Edit 1:

I tried using pip and I got this error.

Command "C:\Python34\python.exe -c "import setuptools, tokenize;__file__='C:
ers\\user\\AppData\\Local\\Temp\\pip-build-1nitmoob\\PyOpenGL-accelerate\\se
py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\
, '\n'), __file__, 'exec'))" install --record C:\Users\user\AppData\Local\Te
ip-_p9qo3yf-record\install-record.txt --single-version-externally-managed --
ile" failed with error code 1 in C:\Users\user\AppData\Local\Temp\pip-build-
moob\PyOpenGL-accelerate

The video I am using is https://www.youtube.com/watch?v=Snl7UwuMoD4&list=PL6gx4Cwl9DGAjkwJocj7vlc_mFU-4wXJq&index=91

2
You're using Windows and Python 3.4, right? According to the pyopengl homepage the easiest way to install it is to use pip. Open the command line and enter py -3.4 -m pip install PyOpenGL PyOpenGL_accelerate. This will install pyopengl explicitly for Python 3.4 and runs pip as a module (to avoid PATH variable problems for Windows users). Also please add a link to the video. - skrx
I tried pip install using your command and got an error. I added that error and well as the link to the video at edit number 1. - Bob G.
No idea what's wrong. If import OpenGL works it should actually be installed, but maybe it was installed incorrectly. The "OpenGL" directory should be inside of the C:\Python34\Lib\site-packages directory and it looks like you have it in your Python34 directory. You could try to uninstall or delete all pyopengl related stuff in your Python folder and install it one more time or try a fresh Python (3.6) installation (you could also use a virtualenv if you know how that works). I've just installed only PyOpenGL via pip for Python 3.6 and from OpenGL.GLU import * works. - skrx
BTW, star imports are considered bad practise because they make code harder to read. If a module name is too long for your taste you can shorten it like so: import pygame as pg. - skrx
I actually works now. I changed the 3.6 number to 3.4 and it installed successfully. I tested and it worked. Thanks so much dude. If you could create a short answer, I can give you the correct answer thing if you want. Thanks again. - Bob G.

2 Answers

1
votes

So apparently py -3.4 -m pip install PyOpenGL works now, but we should still try to figure out why it didn't work before.

Users with other operating systems than Windows can just enter pip install PyOpenGL or pip3 install PyOpenGL (for Python 3). This also works on Windows, but the "/Scripts" folder has to be in the PATH.

0
votes

Install the six module, either pip or easy-install. Just keep installing whatever modules it says are missing until it works.