PyOpenGL-accelerate + numpy - python

I'm installing MakeHuman on Debian, so all dependencies was set up, but when launching it's an error:
SYS.PLATFORM: linux2
PLATFORM.MACHINE: x86_64
PLATFORM.PROCESSOR:
PLATFORM.UNAME.RELEASE: 2.6.32.26
PLATFORM.LINUX_DISTRIBUTION: debian 6.0.6
NUMPY.VERSION: 1.6.2
OpenGL_accelerate module loaded
Using accelerated ArrayDatatype
Unable to load numpy_formathandler accelerator from OpenGL_accelerate
Unable to load registered array format handler numeric
Traceback (most recent call last):
File "makehuman.py", line 310, in <module>
main()
File "makehuman.py", line 300, in main
from mhmain import MHApplication
File "./core/mhmain.py", line 32, in <module>
import mh
File "./lib/mh.py", line 29, in <module>
from glmodule import updatePickingBuffer, grabScreen, hasRenderSkin, renderSkin
File "./lib/glmodule.py", line 33, 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 197, 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'
Does anyone solve problems with link PyOpenGL+ numpy?

fixed that on my system by issuing:
sudo easy_install -U PyOpenGL
Noting:
using Ubuntu 12.04 LTS, with python2.7
did get a Permission denied error without that leading 'sudo'
via: http://matthew-4gl.wikispaces.com/python_modules ( in turn from https://bitbucket.org/ompl/ompl/issue/59/problem-with-ompl_apppy )
good luck

Related

Cannot import tensorflow in python3 and ImportError: This package should not be accessible on Python 3

I am trying to use tensorflow for research in my macbook. I use pip3 to install tensorflow in the system (not in virtual environment).
At first, I just want to verify tensorflow can be correctly imported via python3 in terminal. However, sometimes, I got the following problem when importing.
>>>import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/cyan/Library/Python/3.5/lib/python/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/Users/cyan/Library/Python/3.5/lib/python/site-packages/tensorflow/python/__init__.py", line 47, in <module>
import numpy as np
File "/Library/Python/2.7/site-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/Library/Python/2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/Library/Python/2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/Library/Python/2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/Library/Python/2.7/site-packages/numpy/core/__init__.py", line 14, in <module>
from . import multiarray
ImportError: dlopen(/Library/Python/2.7/site-packages/numpy/core/multiarray.so, 2): Symbol not found: _PyBuffer_Type
Referenced from: /Library/Python/2.7/site-packages/numpy/core/multiarray.so
Expected in: flat namespace in /Library/Python/2.7/site-packages/numpy/core/multiarray.so
This error could only be solved if I ran the following code firstly before python3 execution
unset PYTHONPATH
If I didn't unset PYTHONPATH, I also found errors when checking the version of pip3 using
pip3 --version
The errors are shown as follows.
>> pip3 --version
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 6, in <module>
from pip._internal import main
File "/Library/Python/2.7/site-packages/pip/_internal/__init__.py", line 19, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
File "/Library/Python/2.7/site-packages/pip/_vendor/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/Library/Python/2.7/site-packages/pip/_vendor/urllib3/connectionpool.py", line 11, in <module>
from .exceptions import (
File "/Library/Python/2.7/site-packages/pip/_vendor/urllib3/exceptions.py", line 2, in <module>
from .packages.six.moves.http_client import (
File "/Library/Python/2.7/site-packages/pip/_vendor/urllib3/packages/six.py", line 203, in load_module
mod = mod._resolve()
File "/Library/Python/2.7/site-packages/pip/_vendor/urllib3/packages/six.py", line 115, in _resolve
return _import_module(self.mod)
File "/Library/Python/2.7/site-packages/pip/_vendor/urllib3/packages/six.py", line 82, in _import_module
__import__(name)
File "/Library/Python/2.7/site-packages/http/__init__.py", line 7, in <module>
raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
I thought it was so inconvenient to unset PYTHONPATH every time, so is there any solutions for this problem? I also want to import tensorflow in other text editor, such as Sublime and Pycharm, so I was really not sure what to do next.
I tried the same scenario. It is working fine for me. In the first error it seems your python installation is messed up. If you are using python3 in terminal, it should not refer to 2.7 libraries.
Also I dont think you require unset PYTHONPATH everytime. First thing is you dont need to setup PYTHONPATH. It seems the installation got issue.
You using homebrew in mac to install packages. If not I will say use homebrew and it will work as charm. As it adds dependency properly.
Thanks,
Ashish

when I “import nltk” show selectSelector error

>>> import nltk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/hexialong/anaconda3/lib/python3.6/site-packages/nltk/__init__.py", line 89, in <module>
from nltk.internals import config_java
File "/Users/hexialong/anaconda3/lib/python3.6/site-packages/nltk/internals.py", line 11, in <module>
import subprocess
File "/Users/hexialong/anaconda3/lib/python3.6/subprocess.py", line 138, in <module>
import selectors
File "/Users/hexialong/anaconda3/lib/python3.6/selectors.py", line 290, in <module>
class SelectSelector(_BaseSelectorImpl):
File "/Users/hexialong/anaconda3/lib/python3.6/selectors.py", line 317, in SelectSelector
_select = select.select
AttributeError: module 'select' has no attribute 'select'
My environment is MacOS and python version is 3.6
select is a Python standard module. Maybe you should check that your python binaries are unbroken or just reinstall it.
Check that:
import select and select.select in Python Interactive Environment. If some errors generated, you'd better reinstall the python binaries.

How to install AntTweakbar on Ubuntu 14.04?

I followed the instructions for how to install the AntTweakBar python module which I found on the AntTweakBar website (http://anttweakbar.sourceforge.net/doc/tools:anttweakbar:download)
When I try to run my code which uses this library, I get the following error:
Traceback (most recent call last):
File "main.py", line 80, in <module>
from eye import eye
File "/home/phil/pupil-master/pupil_src/capture/eye.py", line 17, in <module>
import atb
File "/home/phil/pupil-master/pupil_src/shared_modules/atb/__init__.py", line 16, in <module>
from raw import *
File "/home/phil/pupil-master/pupil_src/shared_modules/atb/raw.py", line 39, in <module>
__dll__ = ctypes.CDLL(dll_path)
File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/libAntTweakBar.so.1: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE
So I added a symbolic link from the AntTweakBar/src to a directory in my pupil path using
ln -s pwd /usr/lib/python2.7/dist-packages
Thanks!
Edit: I'm using ctypes.

Error importing sdl2 in python3

I have a file test.py which contains only the line "import sdl2". I am running Ubuntu and have installed libsdl2 from the official repos and installed pysdl2 from pip3. I get this error:
Traceback (most recent call last):
File "./test.py", line 2, in <module>
import sdl2
File "/usr/local/lib/python3.3/dist-packages/sdl2/__init__.py", line 11, in <module>
from .events import *
File "/usr/local/lib/python3.3/dist-packages/sdl2/events.py", line 5, in <module>
from .keyboard import SDL_Keysym
File "/usr/local/lib/python3.3/dist-packages/sdl2/keyboard.py", line 7, in <module>
from .video import SDL_Window
File "/usr/local/lib/python3.3/dist-packages/sdl2/video.py", line 256, in <module>
SDL_GL_ResetAttributes = _bind("SDL_GL_ResetAttributes")
File "/usr/local/lib/python3.3/dist-packages/sdl2/dll.py", line 84, in bind_function
(funcname, self._dll))
ValueError: could not find function 'SDL_GL_ResetAttributes' in <CDLL 'libSDL2-2.0.so.0', handle 1088720 at 7fdce18f5910>
My only thought is that possibly there's some version mismatch in packages? I couldn't find anything referencing this bug after a quick googling.
This is a bug in pysdl2, which indicates that your SDL2 library version is not the latest one. (2.0.3). It has been fixed in a recent commit: https://bitbucket.org/marcusva/py-sdl2/commits/03870c58615b115abf14b11056bbcd41652873c5

Problem importing pylab in Ubuntu 8.1

I have installed numpy1.3,scipy 0.7.1,matplotlib 0.99.1.1 and python 2.5
when I import pylab I get the following error. Someone please help.
/var/lib/python-support/python2.5/gtk-2.0/gtk/__init__.py:72: GtkWarning: could not open display
warnings.warn(str(e), _gtk.Warning)
/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py:44: GtkWarning: gdk_cursor_new_for_display: assertion `GDK_IS_DISPLAY (display)' failed
cursors.MOVE : gdk.Cursor(gdk.FLEUR),
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "/usr/lib/python2.5/site-packages/matplotlib/pylab.py", line 247, in <module>
from matplotlib.pyplot import *
File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 78, in <module>
new_figure_manager, draw_if_interactive, show = pylab_setup()
File "/usr/lib/python2.5/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup
globals(),locals(),[backend_name])
File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in <module>
from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\
File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py", line 44, in <module>
cursors.MOVE : gdk.Cursor(gdk.FLEUR),
RuntimeError: could not create GdkCursor object
try using a different backend for plotting than Gtk.
Open the python console and type:
>>> import matplotlib
>>> matplotlib.matplotlib_fname()
This will print a file name. Edit this file and modify the section 'Backend' and change Gtk or GtkAgg with any other (see the documentation in the same file), until you get it working.
You can find more information about backends here.
As for why you get an error when you try to use that backend, it depends on how you have installed the libraries and what you have installed on your computer. I would recommend to install matplotlib with synaptic/yum and selecting all optional dependencies.

Categories

Resources