mkeeter / kokopelli

Script-based CAD/CAM in Python (deprecated)
https://mattkeeter.com/projects/kokopelli
Other
298 stars 49 forks source link

crashes on startup with 'module' object has no attribute 'sizeof' #5

Closed blaisepascal closed 10 years ago

blaisepascal commented 10 years ago

After installing and building from source on Ubuntu 13.04, running it gets me the following error:

importing koko.glcanvasNo handlers could be found for logger "OpenGL.arrays.numpymodule"

Traceback (most recent call last):
  File "/usr/local/bin/kokopelli", line 64, in <module>
    from koko.app import App
  File "/usr/local/bin/koko/app.py", line 22, in <module>
    from   koko.frame       import MainFrame
  File "/usr/local/bin/koko/frame.py", line 16, in <module>
    from    koko.glcanvas  import GLCanvas
  File "/usr/local/bin/koko/glcanvas.py", line 18, in <module>
    from OpenGL.GL      import *
  File "/usr/lib/python2.7/dist-packages/OpenGL/GL/__init__.py", line 3, in <module>
    from OpenGL.raw.GL.annotations import *
  File "/usr/lib/python2.7/dist-packages/OpenGL/raw/GL/annotations.py", line 40, in <module>
    'v',
  File "/usr/lib/python2.7/dist-packages/OpenGL/arrays/arrayhelpers.py", line 177, in setInputArraySizeType
    function.setPyConverter( argName, asArrayTypeSize(type, size) )
  File "arraydatatype.pyx", line 393, in OpenGL_accelerate.arraydatatype.AsArrayTypedSizeChecked.__init__ (src/arraydatatype.c:7688)
AttributeError: 'module' object has no attribute 'sizeof'
mkeeter commented 10 years ago

I recently changed the python package build order (on the wiki) from sudo pip install PyOpenGL PyOpenGL_accelerate numpy to sudo pip install numpy PyOpenGL PyOpenGL_accelerate so that PyOpenGL knows about numpy. Do you remember which order you used?

If it was the former, you should try uninstalling and re-installing the OpenGL packages (sudo pip uninstall PyOpenGL PyOpenGL_accelerate; sudo pip install PyOpenGL PyOpenGL_accelerate) so that they can to link against the install numpy package.

blaisepascal commented 10 years ago

I didn't remember which order I used, but now that I'm home, my shell's command history remembered for me.

I used sudo pip install numpy PyOpenGL PyOpenGL_accelerate

I'll try uninstall/reinstall anyway, but if the order I did was correct, it shouldn't help.

blaisepascal commented 10 years ago

Now I get:

[||||||||||]    starting...                                                     
Traceback (most recent call last):
  File "/usr/local/bin/kokopelli", line 71, in <module>
    app = App()
  File "/usr/local/lib/python2.7/dist-packages/wx/_core.py", line 8631, in __init__
    self._BootstrapApp()
  File "/usr/local/lib/python2.7/dist-packages/wx/_core.py", line 8196, in _BootstrapApp
    return _core_.PyApp__BootstrapApp(*args, **kwargs)
  File "/usr/local/bin/koko/app.py", line 74, in OnInit
    koko.FRAME = MainFrame(self)
  File "/usr/local/bin/koko/frame.py", line 83, in __init__
    koko.GLCANVAS = GLCanvas(self, size=(300, 300))
  File "/usr/local/bin/koko/glcanvas.py", line 53, in __init__
    self.context = glcanvas.GLContext(self)
  File "/usr/local/lib/python2.7/dist-packages/wx/glcanvas.py", line 67, in __init__
    _glcanvas.GLContext_swiginit(self,_glcanvas.new_GLContext(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "fbc" failed at /home/blaisepascal/wxPython-src-    2.9.5.0/src/unix/glx11.cpp(51) in wxGLContext(): invalid GLXFBConfig for OpenGL

I'm investigating if there's something wrong with my OpenGL setup, but I don't seem to have problems with other applications.

mkeeter commented 10 years ago

Have you pulled recently? Rahji saw the same error message and my changes in 823a93438d9c5f75e16d19339a9ab96e5d971b0c resolved his issue.

blaisepascal commented 10 years ago

After a pull, a "make clean", a minor grumbling that no "clean" target exists in the makefile, a "rm -rf build; make; sudo make install", and a reattempt at running, I'm on to the next error:

[||||||||||]    starting...                                                     
Traceback (most recent call last):
  File "/usr/local/bin/koko/glcanvas.py", line 149, in evt_paint
    self.init_GL()
  File "/usr/local/bin/koko/glcanvas.py", line 398, in init_GL
    self.compile_shaders()
  File "/usr/local/bin/koko/glcanvas.py", line 357, in compile_shaders
    shaders.compileShader(path_fs, GL_FRAGMENT_SHADER))
  File "/usr/local/lib/python2.7/dist-packages/OpenGL/GL/shaders.py", line 227, in compileShader
    shaderType,
   RuntimeError: ('Shader compile failure (0): Fragment shader failed to compile with the following errors:\nERROR: 0:10: error(#162) Wrong operand types: no operation ":" exists that takes a left-hand operand of type "const float" and a right operand of type "const int" (or there is no acceptable conversion)\nERROR: error(#273) 1 compilation errors.  No code generated\n\n', ['\n            #version 120\n\n            varying float color;\n            uniform int show_traverses;\n\n            void main() {\n                if (color == 0)\n                    gl_FragColor = vec4(0.9, 0.2, 0.2,\n                                        show_traverses > 0 ? 0.5 : 0);\n                else\n                    gl_FragColor = vec4(0.3*color+0.2,\n                                        0.8*color+0.2,\n                                        (1-color),\n                                        0.9);\n            }\n        '], GL_FRAGMENT_SHADER)
Traceback (most recent call last):
  File "/usr/local/bin/koko/glcanvas.py", line 141, in evt_size
    self.init_GL()
  File "/usr/local/bin/koko/glcanvas.py", line 398, in init_GL
    self.compile_shaders()
  File "/usr/local/bin/koko/glcanvas.py", line 357, in compile_shaders
    shaders.compileShader(path_fs, GL_FRAGMENT_SHADER))
  File "/usr/local/lib/python2.7/dist-packages/OpenGL/GL/shaders.py", line 227, in compileShader
    shaderType,
   RuntimeError: ('Shader compile failure (0): Fragment shader failed to compile with the following errors:\nERROR: 0:10: error(#162) Wrong operand types: no operation ":" exists that takes a left-hand operand of type "const float" and a right operand of type "const int" (or there is no acceptable conversion)\nERROR: error(#273) 1 compilation errors.  No code generated\n\n', ['\n            #version 120\n\n            varying float color;\n            uniform int show_traverses;\n\n            void main() {\n                if (color == 0)\n                    gl_FragColor = vec4(0.9, 0.2, 0.2,\n                                        show_traverses > 0 ? 0.5 : 0);\n                else\n                    gl_FragColor = vec4(0.3*color+0.2,\n                                        0.8*color+0.2,\n                                        (1-color),\n                                        0.9);\n            }\n        '], GL_FRAGMENT_SHADER)
Traceback (most recent call last):
  File "/usr/local/bin/kokopelli", line 71, in <module>
    app = App()
  File "/usr/local/lib/python2.7/dist-packages/wx/_core.py", line 8631, in __init__
    self._BootstrapApp()
  File "/usr/local/lib/python2.7/dist-packages/wx/_core.py", line 8196, in _BootstrapApp
    return _core_.PyApp__BootstrapApp(*args, **kwargs)
  File "/usr/local/bin/koko/app.py", line 94, in OnInit
    koko.GLCANVAS.init_GL()
  File "/usr/local/bin/koko/glcanvas.py", line 398, in init_GL
    self.compile_shaders()
  File "/usr/local/bin/koko/glcanvas.py", line 357, in compile_shaders
    shaders.compileShader(path_fs, GL_FRAGMENT_SHADER))
  File "/usr/local/lib/python2.7/dist-packages/OpenGL/GL/shaders.py", line 227, in compileShader
    shaderType,
 RuntimeError: ('Shader compile failure (0): Fragment shader failed to compile with the following errors:\nERROR: 0:10: error(#162) Wrong operand types: no operation ":" exists that takes a left-hand operand of type "const float" and a right operand of type "const int" (or there is no acceptable conversion)\nERROR: error(#273) 1 compilation errors.  No code generated\n\n', ['\n            #version 120\n\n            varying float color;\n            uniform int show_traverses;\n\n            void main() {\n                if (color == 0)\n                    gl_FragColor = vec4(0.9, 0.2, 0.2,\n                                        show_traverses > 0 ? 0.5 : 0);\n                else\n                    gl_FragColor = vec4(0.3*color+0.2,\n                                        0.8*color+0.2,\n                                        (1-color),\n                                        0.9);\n            }\n        '], GL_FRAGMENT_SHADER)

For the record, I'm running Raring Ringtail (Ubuntu 13.04) on an AMD system (A6, Radeon HD 7540D).

What is the best way to cleanly rebuild kokopelli after a git pull?

mkeeter commented 10 years ago

I'm on an Nvidia card, and it looks like they are more forgiving about implicitly casting ints to floats -- see if 472a78b0775578b1218d96b50fd2751c2c9de187 resolves your problem.

I also added a make clean target, but CMake (which is used under the Makefile's hood) is pretty good at tracking dependancies -- make; sudo make install should be enough.

blaisepascal commented 10 years ago

That did it. it now runs. Now I get to figure out how it works.