PyBox2d and Linux
Hi!I got surprised of how many Pyweek9 games are using PyBox2d, and i were having huge difficulties on installing on Ubuntu Linux.
What are .egg files from http://code.google.com/p/pybox2d/downloads/list - are they tarballs, .sh, or something else?
Is it only me having problems running these PyBox2d games?
(log in to comment)
Comments
and how can i install pybox2d.egg? where these files must be installed in the filesystem? (seems to be simple making a tarball from them and doing a 'tar -zxvf tarball.tar.gz -C /', but i don't know where to target these files before creating that tarball)
thanks in advance...
2nitrofurano: get box2d from the ubuntu repository. If there are no Ubuntu packages, I'm afraid you'll have to download and build it manually. To install egg files just use easy_install, it does all the work for you.
how do i use easy_install , and how can i install .egg files from it? i have no idea what about is it...
guest@p4:~$ man easy_install
No manual entry for easy_install
See 'man 7 undocumented' for help when manual pages are not available.
guest@p4:~$
guest@p4:/mnt/sda1/trabalhos/pygame/bibliotecas$ sudo easy_install Box2D-2.0.2b1-py2.5-linux-i686.egg
Processing Box2D-2.0.2b1-py2.5-linux-i686.egg
Removing /usr/local/lib/python2.6/dist-packages/Box2D-2.0.2b1-py2.5-linux-i686.egg
Copying Box2D-2.0.2b1-py2.5-linux-i686.egg to /usr/local/lib/python2.6/dist-packages
Box2D 2.0.2b1 is already the active version in easy-install.pth
Installed /usr/local/lib/python2.6/dist-packages/Box2D-2.0.2b1-py2.5-linux-i686.egg
Processing dependencies for Box2D==2.0.2b1
Searching for Box2D==2.0.2b1
Reading http://pypi.python.org/simple/Box2D/
Reading http://pybox2d.googlecode.com/
Reading http://code.google.com/p/pybox2d/downloads/list
Best match: Box2D 2.0.2b1
Downloading http://pybox2d.googlecode.com/files/Box2D-2.0.2b1.zip
Processing Box2D-2.0.2b1.zip
Running Box2D-2.0.2b1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-_iedCp/Box2D-2.0.2b1/egg-dist-tmp-WS2jkU
Using setuptools.
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
Box2D/Box2D_wrap.cpp:146:20: error: Python.h: No such file or directory
Box2D/Box2D_wrap.cpp:3098:4: error: #error "This python version requires swig to be run with the '-classic' option"
Box2D/Box2D_wrap.cpp:3102:3: error: #error "This python version requires swig to be run with the '-nomodern' option"
Box2D/Box2D_wrap.cpp:3105:3: error: #error "This python version requires swig to be run with the '-nomodernargs' option"
Box2D/Box2D_wrap.cpp:3108:3: error: #error "This python version requires swig to be run with the '-nofastunpack' option"
Box2D/Box2D_wrap.cpp:752: error: expected initializer before ‘*’ token
Box2D/Box2D_wrap.cpp:807: error: expected initializer before ‘*’ token
Box2D/Box2D_wrap.cpp:828: error: expected initializer before ‘*’ token
In file included from /usr/include/c++/4.3/new:45,
from /usr/include/c++/4.3/ext/new_allocator.h:37,
from /usr/include/c++/4.3/i486-linux-gnu/bits/c++allocator.h:39,
from /usr/include/c++/4.3/bits/allocator.h:53,
from /usr/include/c++/4.3/string:48,
from Box2D/Box2D_wrap.cpp:2517:
/usr/include/c++/4.3/exception:40: error: expected declaration before end of line
error: Setup script exited with error: command 'gcc' failed with exit status 1
guest@p4:/mnt/sda1/trabalhos/pygame/bibliotecas$
guest@p4:~/Desktop$ sudo easy_install box2d
[sudo] password for guest:
Searching for box2d
Reading http://pypi.python.org/simple/box2d/
Reading http://pybox2d.googlecode.com/
Reading http://code.google.com/p/pybox2d/downloads/list
Best match: Box2D 2.0.2b1
Downloading http://pybox2d.googlecode.com/files/Box2D-2.0.2b1.zip
Processing Box2D-2.0.2b1.zip
Running Box2D-2.0.2b1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-CHjKAB/Box2D-2.0.2b1/egg-dist-tmp-NsLuLE
Using setuptools.
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
Box2D/Box2D_wrap.cpp:146:20: error: Python.h: No such file or directory
Box2D/Box2D_wrap.cpp:3098:4: error: #error "This python version requires swig to be run with the '-classic' option"
Box2D/Box2D_wrap.cpp:3102:3: error: #error "This python version requires swig to be run with the '-nomodern' option"
Box2D/Box2D_wrap.cpp:3105:3: error: #error "This python version requires swig to be run with the '-nomodernargs' option"
Box2D/Box2D_wrap.cpp:3108:3: error: #error "This python version requires swig to be run with the '-nofastunpack' option"
Box2D/Box2D_wrap.cpp:752: error: expected initializer before ‘*’ token
Box2D/Box2D_wrap.cpp:807: error: expected initializer before ‘*’ token
Box2D/Box2D_wrap.cpp:828: error: expected initializer before ‘*’ token
In file included from /usr/include/c++/4.3/new:45,
from /usr/include/c++/4.3/ext/new_allocator.h:37,
from /usr/include/c++/4.3/i486-linux-gnu/bits/c++allocator.h:39,
from /usr/include/c++/4.3/bits/allocator.h:53,
from /usr/include/c++/4.3/string:48,
from Box2D/Box2D_wrap.cpp:2517:
/usr/include/c++/4.3/exception:40: error: expected declaration before end of line
error: Setup script exited with error: command 'gcc' failed with exit status 1
guest@p4:~/Desktop$
guest@p4:~/Desktop$ easy_install box2d
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/usr/local/lib/python2.6/dist-packages/test-easy-install-20710.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python2.6/dist-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
http://peak.telecommunity.com/EasyInstall.html
Please make the appropriate changes for your system and try again.
guest@p4:~/Desktop$
guest@p4:/mnt/sda1/trabalhos/pygame/recolhas/pyweek/09/30_PyWorld_FlightOfIcarusPyWorldFinal_box2d$ python run_game.py
Traceback (most recent call last):
File "run_game.py", line 1, in <module>
import Icarus.main
File "/mnt/sda1/trabalhos/pygame/recolhas/pyweek/09/30_PyWorld_FlightOfIcarusPyWorldFinal_box2d/Icarus/main.py", line 10, in <module>
import Box2D
File "/mnt/sda1/trabalhos/pygame/recolhas/pyweek/09/30_PyWorld_FlightOfIcarusPyWorldFinal_box2d/Box2D/__init__.py", line 23, in <module>
from Box2D import *
File "/mnt/sda1/trabalhos/pygame/recolhas/pyweek/09/30_PyWorld_FlightOfIcarusPyWorldFinal_box2d/Box2D/Box2D.py", line 43, in <module>
_Box2D = swig_import_helper()
File "/mnt/sda1/trabalhos/pygame/recolhas/pyweek/09/30_PyWorld_FlightOfIcarusPyWorldFinal_box2d/Box2D/Box2D.py", line 41, in swig_import_helper
if fp is not None: fp.close()
UnboundLocalError: local variable 'fp' referenced before assignment
guest@p4:/mnt/sda1/trabalhos/pygame/recolhas/pyweek/09/30_PyWorld_FlightOfIcarusPyWorldFinal_box2d$
it seems to happen also on all other pybox2d games...
Egg files are a distribution format used by setuptools. If you don't have setuptools installed, you should be able to unzip the egg file (it's just a zip file) and manually move the relevant files into the site-packages folder of your Python installation.
I installed PyBox2D from source, and found that it failed to install a file called Box2D.py. I found it in the source distribution and installed it manually, and things seemed to work after that.
kent_turbo on 2009/09/11 11:51:
You have to install libbox2d first, then install pybox2d egg.