Trouble installing Pygame on a Mac - python

I've installed Python 2.7 and Pygame on my Mac, but every time I try to 'import pygame', I get this error message:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pygame
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 95, in <module>
from pygame.base import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so: no matching architecture in universal wrapper
What am I doing wrong?

This is a typical architecture issue. Try a
file /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so
If one of the result lines includes your architecture (e.g. i386), then the problem is not from the package itself, but from the way you launched it. Try then to launch it from a 32 bits instance of Python:
python2.7-32
>>>import pygame
NB: you can guess your architecture with
uname -m

Related

import .vtk error in Python

I have Windows 8 64 bit and Python 2.11 64 bit. I install VTK library using pip command. It shows the following error while running:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import vtk
File "C:\Python27\lib\site-packages\vtk\__init__.py", line 72, in <module>
__helper.refine_import_err('rendering', 'vtkRenderingPython', exc)
File "C:\Python27\lib\site-packages\vtk\__helper.py", line 32, in refine_import_err
raise LinkError, str(exc)
LinkError: DLL load failed: The specified module could not be found.` Traceback
My PATH are:
C:\Python27\Lib;
C:\Python27\Lib\site-packages;
C:\Python27\Lib\site-packages\vtk;
C:\Python27\Scripts;
Thanks for your help.
I could solve the problem with uninstalling .vtk 5 and installing vtk 6.2. 0 from http://www.lfd.uci.edu/~gohlke/pythonlibs/. I also install PyQt4
In my case, the problem was resolved by adding PyQt4's directory to PATH, as suggested here. That is, the directory similar to
C:\Python27\Lib\site-packages\PyQt4
which contains the DLL that it's looking for.

import healpy unicode error with enthought canopy python

I'm running Ubuntu 12.10
Enthought Canopy Python 2.7.6 64 bit
I have succesfully installed healpy using the direct Healpix configuration as well as using sud pip install healpy, and have made sure PYTHONPATH was set accordingly in the bashrc.
When I try to import healpy I get this unicode incomparability related error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/healpy/__init__.py", line 47, in <module>
from sphtfunc import (anafast, map2alm,
File "/usr/local/lib/python2.7/dist-packages/healpy/sphtfunc.py", line 26, in <module>
import _sphtools as _sphtools
ImportError: /usr/local/lib/python2.7/dist-packages/healpy/_sphtools.so: undefined symbol: PyUnicodeUCS4_DecodeUTF8
Related issues have solutions that require rebuilding. I'm not sure how to go about doing this, and was wondering if there is an easier solution. Thank you in advance for any assistance.

Ropevim error in mac os 10.8.4

I use ropevim perfectly in Ubuntu system,
but i got lots of lots error.
i use homebrew to install macvim and python
and follow the tutorial.
http://wizardmode.com/2012/07/mountain-lion-and-homebrew-vim-importerror-no-module-named-site/
I wander know is the ropevim are very buggy or not practical in mac os system.
because the discussion is not popular?
or is there any better solution in vim for Python on mac os?
Thanks very much...it's annoying me lots of time
>>> import rope
>>> import ropevim
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ropevim-0.3_rc-py2.7.egg/ropevim.py", line 10, in <module>
import vim
ImportError: No module named vim
and when I put the ropevim.vim in .vim/plugin
I will got the error when using vim
/install/ropehg/ropemode:vim la
Error detected while processing function LoadRope:
line 3:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/pyt
hon2.7/site-packages/ropevim-0.3_rc-py2.7.egg/ropevim.py", line 3, in <module>
import tempfile
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/pyt
hon2.7/tempfile.py", line 32, in <module>
import io as _io
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/pyt
hon2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions
/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyInt_AsInt
Referenced from: /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/
2.7/lib/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2
.7/lib-dynload/_io.so
I encountered a very similar stack trace when setting up some vim extensions from this page http://sontek.net/blog/detail/turning-vim-into-a-modern-python-ide
I believe the problem comes from incompatibilities between 'macport' and native python libraries, and that the native version of vim tries to pull from both.
I ultimately resolved my problem by using macport to install vim with python27 variant.
sudo port install vim +python27
The default configuration of macport's vim is without 'python' enabled.

Importing Pygame: Strange DLL Error

I've recently downloaded Pygame for the first time on this computer. When I try to run a script that uses "import pygame" it gives me this error:
Traceback (most recent call last):
File "graphs.py", line 1, in <module>
import pygame
File "C:\Python27\lib\site-packages\pygame\__init__.py", line 95, in <module>
from pygame.base import *
ImportError: DLL load failed: %1 is not a valid Win32 application.
Any help would be greatly appreciated.
This error message almost always implies you are using an extension module containing a compiled DLL for a 64-bit version of Python but you're running a 32-bit version of Python. Or vice-versa.

pySerial not working on Python3.2.2

I installed the 32 bit version of Python 3.2.2 and want to get the pySerial package to work. I most definitely have the pyWin32 package install but still when I try to import serial it gives me this error
>>> import serial
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Python32\lib\site-packages\serial\__init__.py", line 19, in <module>
from serialwin32 import *
ImportError: No module named serialwin32
>>>
Any help?
Search around in your C:/Python32/Lib/site-packages/serial/. See if you can find a file named serialwin32. If not, you should try uninstalling pywin32 and reinstalling it.

Categories