#259 opengl-accelerate import level >=0 for python 3.3

Mark Moll

There is an incompatibility between python 3.3 and PyOpenGL-accelerate that is fortunately easy to fix. Attached is a patch. Without it, you get errors of this sort:

File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/OpenGL/GL/__init__.py", line 3, in <module>
  from OpenGL.GL.VERSION.GL_1_1 import *
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/OpenGL/GL/VERSION/GL_1_1.py", line 10, in <module>
  from OpenGL import platform, constants, constant, arrays
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/OpenGL/arrays/__init__.py", line 19, in <module>
  from OpenGL.arrays.arraydatatype import *
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/OpenGL/arrays/arraydatatype.py", line 14, in <module>
  from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT
File "arraydatatype.pyx", line 1, in init OpenGL_accelerate.arraydatatype (src/arraydatatype.c:9315)
File "wrapper.pyx", line 2, in init OpenGL_accelerate.wrapper (src/wrapper.c:10792)
ValueError: level must be >= 0


  • Mike C. Fletcher

    • status: open --> closed-fixed
    • assigned_to: Mike C. Fletcher
  • Mike C. Fletcher

    Thanks for the bug report. Note that you actually patched auto-generated files, rather than the source files. Cython updated to 0.19.1 seems to have generated Python 3.3 compatible files in my testing.

  • Mark Moll

    Mark Moll - 2013-07-11

    The auto-generated are included in the source distribution and not generated at build time. Could you update the opengl-accelerate tar ball with correct auto-generated files? Or is there an easy additional build step to regenerate the code with cython?

  • Mike C. Fletcher

    The step isn't obvious (you have to delete the generated src/.c files and then re-run setup.py install with cython installed). To release* a new accelerate module I need to boot into Windows and spend time compiling the modules for the various Python versions (and testing the results). I'm afraid I don't have time to get that done this week.

    I don't want to silently update the files (i.e. same version different sources), as the regenerated files are quite different from the originals, since this is a new major version of cython generating them.

  • Mark Moll

    Mark Moll - 2013-07-11

    If I remove all *.c files and try to install I get errors like these:

    from OpenGL_accelerate.wrapper cimport cArgConverter, pyArgConverter, returnConverter
    arraydatatype.pyx:7:0: 'OpenGL_accelerate.wrapper.pxd' not found

    It seems like formathandler.c and wrapper.c were correctly generated, but cython choked on arraydatatype.pyx. This happens both with python2.7 and python3.3.

  • Antoine Martin

    Antoine Martin - 2014-03-10

    3.1.0 beta1 fails to build on OSX 10.5 with gcc 4.2 with the same error as in the comment above.
    3.0.2 builds fine however.

    I am using Cython 0.20.1, so that should not be a problem, right?

    Here is the full log up to the first error:

    $ unzip PyOpenGL-accelerate-3.1.0b1.zip
    $ cd PyOpenGL-accelerate-3.1.0b1
    $ python ./setup.py build
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.5-i386-2.7
    creating build/lib.macosx-10.5-i386-2.7/OpenGL_accelerate
    copying ./__init__.py -> build/lib.macosx-10.5-i386-2.7/OpenGL_accelerate
    running build_ext
    skipping 'src/wrapper.c' Cython extension (up-to-date)
    building 'OpenGL_accelerate.wrapper' extension
    creating build/temp.macosx-10.5-i386-2.7
    creating build/temp.macosx-10.5-i386-2.7/src
    /usr/bin/gcc-4.2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -I/Users/MacAdmin/gtk/inst/include -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -isysroot /Developer/SDKs/MacOSX10.5.sdk -I.. -Isrc -I/Users/MacAdmin/gtk/inst/include/python2.7 -c src/wrapper.c -o build/temp.macosx-10.5-i386-2.7/src/wrapper.o
    /usr/bin/gcc-4.2 -bundle -undefined dynamic_lookup -L/Users/MacAdmin/gtk/inst/lib -L/Users/MacAdmin/gtk/inst/lib -arch i386 -L/Developer/SDKs/MacOSX10.5.sdk/usr/lib -L/Users/MacAdmin/gtk/inst/lib -L/Users/MacAdmin/gtk/inst/lib -arch i386 -L/Developer/SDKs/MacOSX10.5.sdk/usr/lib -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -Wl,-headerpad_max_install_names -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -Wl,-headerpad_max_install_names -L/Users/MacAdmin/gtk/inst/lib -L/Users/MacAdmin/gtk/inst/lib -arch i386 -L/Developer/SDKs/MacOSX10.5.sdk/usr/lib -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -Wl,-headerpad_max_install_names -arch i386 -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -I/Users/MacAdmin/gtk/inst/include -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -isysroot /Developer/SDKs/MacOSX10.5.sdk build/temp.macosx-10.5-i386-2.7/src/wrapper.o -L/Users/MacAdmin/gtk/inst/lib -o build/lib.macosx-10.5-i386-2.7/OpenGL_accelerate/wrapper.so
    skipping 'src/formathandler.c' Cython extension (up-to-date)
    building 'OpenGL_accelerate.formathandler' extension
    /usr/bin/gcc-4.2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -I/Users/MacAdmin/gtk/inst/include -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -isysroot /Developer/SDKs/MacOSX10.5.sdk -I.. -Isrc -I/Users/MacAdmin/gtk/inst/include/python2.7 -c src/formathandler.c -o build/temp.macosx-10.5-i386-2.7/src/formathandler.o
    /usr/bin/gcc-4.2 -bundle -undefined dynamic_lookup -L/Users/MacAdmin/gtk/inst/lib -L/Users/MacAdmin/gtk/inst/lib -arch i386 -L/Developer/SDKs/MacOSX10.5.sdk/usr/lib -L/Users/MacAdmin/gtk/inst/lib -L/Users/MacAdmin/gtk/inst/lib -arch i386 -L/Developer/SDKs/MacOSX10.5.sdk/usr/lib -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -Wl,-headerpad_max_install_names -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -Wl,-headerpad_max_install_names -L/Users/MacAdmin/gtk/inst/lib -L/Users/MacAdmin/gtk/inst/lib -arch i386 -L/Developer/SDKs/MacOSX10.5.sdk/usr/lib -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -Wl,-headerpad_max_install_names -arch i386 -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -I/Users/MacAdmin/gtk/inst/include -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -isysroot /Developer/SDKs/MacOSX10.5.sdk build/temp.macosx-10.5-i386-2.7/src/formathandler.o -L/Users/MacAdmin/gtk/inst/lib -o build/lib.macosx-10.5-i386-2.7/OpenGL_accelerate/formathandler.so
    cythoning src/arraydatatype.pyx to src/arraydatatype.c
    Error compiling Cython file:
    """Cython-coded Array-handling accelerator module"""
    import ctypes
    import OpenGL
    from OpenGL import plugins
    from OpenGL_accelerate.wrapper cimport cArgConverter, pyArgConverter, returnConverter
    src/arraydatatype.pyx:5:0: 'OpenGL_accelerate.wrapper.pxd' not found
    Last edit: Antoine Martin 2014-03-11
  • Antoine Martin

    Antoine Martin - 2014-03-10

    Forgot to mention that this is not using Python 3.x but Python 2.7.6

  • Mike C. Fletcher

    Note that your error is quite different. You are seeing a build failure because cython isn't finding the pxd files. Those are (in the b1 release) in the OpenGL_accelerate directory. I've modified the repository so that they are in the OpenGL_accelerate/src directory instead, and I've made the references in the setup.py script concrete, which should eliminate the particular error you are seeing.

  • Antoine Martin

    Antoine Martin - 2014-03-19

    Confirmed fixed. Thank you very much!

    (sorry for posting this bug here instead of creating a new one, I just assumed it was the same issue as the compilation error message is identical to the one posted in comment just above mine)


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks