Getting the new version of Vpython to work on Ubuntu 10.04 with python2.6
UPDATE!!!!! If you want to do python physics simulations on linux (and if you’ve ended up on this page, you probably do) I’m going to suggest you have a look at pygame. Don’t worry about the name, it’s not just for games. (Although it’s interesting to contemplate how much computational physics is like creating a video game where all the characters are NPCs). Pygame physics simulations
Holy crap was this ever not easy.
The version of vpython that you get by installing through Ubuntu’s package manager is old and doesn’t support extrusions. So. I downloaded vpython 5.72 and read the INSTALL.txt. It made me want to cry. I had a large glass of wine and looked at it again.
I’m pretty sure I already have g++ and OpenGL. Moving on…
Getting the Boost libraries was easy:
$ sudo apt-get install libboost-python-dev
$ sudo apt-get install libboost-signals-dev
$ sudo apt-get install libboost-thread-dev
In synaptic package manager I installed fonttools, libgpcl0 and libgpcl0-dev (not 100% sure these are the right things though).
$ sudo pip install ttfquery
$ sudo apt-get automake
$ sudo apt-get install libgtkglextmm-x11-1.2-dev
$ sudo apt-get install libgtkmm-2.4-dev
$ sudo apt-get install libglademm-2.4-dev
The INSTALL.txt doesn’t really make it clear that you have to install Boost, which is, uh, a thing that is something to do with C++. Go to: http://www.boost.org/doc/libs/1_48_0/more/getting_started/unix-variants.html. Following the instructions, install Boost into /usr/local.
More wine!
Hokay.
You need a thing called GPC – general polygon clipper library, http://www.cs.man.ac.uk/~toby/alan/software/. In Ubuntu it can be installed using the package manager, I used synaptic.
Then you need this: https://github.com/jraedler/polygon2. Yes I know we just installed another thing with ‘polygon’ in the name, but this one is different. The other one is in C++ and this one converts the C++ polygons to Python polygons. Or something. Download, unzip, and run setup.py.
Hey remember Vpython, the thing we wanted to install in the first place? Go download that from http://vpython.org/contents/download_linux.html. Unzip, cd into the folder visual-5.72_release, and do this:
$ sudo ./configure
$ sudo make
$ sudo make install
Vpython was installed into my /usr/local/lib/python2.6/site-packages/, so I added this line to my ~/.bashrc:
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.6/site-packages/
and restarted the laptop.
In python interpreter:
>>> from visual import *
Hopefully it will work! If not, have fun googling the error messages 🙂
Works! Thanks a lot.
CMRM
November 17, 2012 at 11:05 pm