Skip to content
This repository


bittner edited this page · 6 revisions
Table of Contents

!toc startlevel=2 levels=2

This page explains how to install and run Pyjamas and Pyjamas Desktop with WebKitGTK on Ubuntu.

$ git clone {{{}}}

This should create a directory containing the current development source code.

Run to create the directory, containing wrapper programs necessary to compile Pyjamas applications, and also to create the file for pyjamas-desktop integration.

$ cd pyjamas
pyjamas$ python 

It is useful to add the directory to your `PATH` variable (and/or to ), for example:

pyjamas$ export PATH=`pwd`/bin:$PATH

A first test can be done now:

pyjamas$ cd examples/helloworld/
pyjamas/examples/helloworld$ python .

This generates a directory containing and a lot of other files and directories.

Now you can open in firefox:

pyjamas/examples/helloworld$ firefox output/Hello.html

Now go back to the root directory for the next step.

pyjamas/examples/helloworld$ cd ../..

NOTE: pythonwebkit doesn't support Canvas applications. If you intend to run an app that uses Canvas, instead try xulrunner (only tested on 9.10).

  1. Follow instructions on Take the PyWebKit/GTK route. You may end up installing a few supporting ubuntu packages, but may need to compile libsoup (if your system only has a version of libsoup less than 2.29.90), and definitely python-webkit from source.
  2. To cope with ubuntu's broken python module paths, you may have to set the python path so that the compiled version of python-webkit is chosen over the ubuntu-provided one. This command will need to be run on a per-shell basis or put in some sort of init file. You figure that out. "$ export PYTHONPATH=/usr/local/lib/python2.6/dist-packages/". Debian gets this right (for both python 2.6 and 2.7) so why ubuntu doesn't is entirely the responsibility of the ubuntu developers.
  3. The compiled python-webkit may complain about a missing library, which you should resolve by running "ldconfig", and double-check with "ldconfig -p" that is listed. then also run "ldd /usr/local/lib/python2.6/dist-packages/" to double-check that all runtime dependent libraries can be located.
  4. Make sure your ~/.pyjd/pyjdrc contains the following:

See also: pyjamasubuntuwebkitgtk

(From suzan on the mailing list)

git clone --depth 1 {{{git://}}}
cd pythonwebkit
git checkout python_codegen
cd ..

sudo apt-get install python-dev python-ply

.# note: you only need this if your distro has libsoup version less than 2.29.90
.# most linux distros now have at least libsoup 2.4, now.  so if you can
.# do e.g. "apt-get install libsoup2.4-dev" instead, you can skip ahead...
git clone {{{git://}}}
cd libsoup
git checkout LIBSOUP_2_29_90

apt-get install the following before running in libsoup:

./ --without-gnome
./configure --without-gnome
sudo make install
cd ..

(If you have problems when building libsoup with header files such as glib.h not being found, 
it may be that setting PKG_CONFIG_PATH to an appropriate value helps: for example I found 
I had to set it to 
before this would work.)

.#... to here. to reiterate: this is the point where you can skip ahead
.# if you can do "apt-get install libsoup2.4-dev" or other version of
.# libsoup which is clearly greater than 2.29.90.

sudo apt-get install build-essential
sudo apt-get build-dep libwebkit-1.0-2
sudo apt-get install libwebkit-1.0-2
sudo apt-get remove libwebkit-1.0-2

cd pythonwebkit
mkdir build
cd build
sudo make install
cd ../..

.# quick sanity check that python can import pywebkitgkt
>>> import pywebkitgtk
.# if there is a problem here it may be helpful to check /etc/ to ensure
.# it contains /usr/local/lib, and also to run ldconfig -p to double-check t
.# hat the python webkit library is listed.
.# also consider doing "ldd /usr/local/lib/"
.# and double-check that the library can find all its runtime libs.

Create the file

mkdir {{{~/.pyjd}}}
vi {{{~/.pyjd/pyjdrc}}}
Save the following 2 lines in

In pyjamas dir:

python build
sudo python install

Finally, test the Mail application using Pyjamas Desktop

cd examples/mail

Now you can in principle run pyjamas applications the normal way, but it will fail:

pyjamas/examples/helloworld$ python
Traceback (most recent call last):
  File "", line 1, in <module>
    import pyjd # this is dummy in pyjs.
  File "/home/marcus/projects/pyjamas/pyjamas/pyjd/{{{}}}.py", line 36, in <module>
    from hula import *
  File "/home/marcus/projects/pyjamas/pyjamas/pyjd/", line 22, in <module>
    import hulahop
ImportError: No module named hulahop

So, to make this work, you need to install the necessary prerquisites.

The following should work, but doesn't in current Ubuntu (2009-11-08)

$ sudo apt-get install python-hulahop

You probably still get an error:

pyjamas/examples/helloworld$ python 
Traceback (most recent call last):
  File "", line 1, in <module>
    import pyjd # this is dummy in pyjs.
  File "/home/marcus/projects/pyjamas/pyjamas/pyjd/{{{}}}.py", line 36, in <module>
    from hula import *
  File "/home/marcus/projects/pyjamas/pyjamas/pyjd/", line 22, in <module>
    import hulahop
  File "/usr/lib/python2.6/dist-packages/hulahop/{{{}}}.py", line 29, in <module>
    from hulahop._hulahop import shutdown
ImportError: cannot open shared object file: No such file or directory

Unfortunately, the Ubuntu package of python-hulahop is a failure, so you need to rebuild it instead (you need to repeat this whenever you update your browser).

$ mkdir ~/build-hulahop
$ cd ~/build-hulahop
$ sudo apt-get build-dep hulahop
$ sudo apt-get -b source hulahop
$ sudo dpkg -i python-hulahop_0.4.9-1ubuntu2_amd64.deb 

But it still fails:

$ python 
Traceback (most recent call last):
  File "", line 1, in <module>
    import pyjd # this is dummy in pyjs.
  File "/home/marcus/projects/pyjamas/pyjamas/pyjd/{{{}}}.py", line 36, in <module>
    from hula import *
  File "/home/marcus/projects/pyjamas/pyjamas/pyjd/", line 26, in <module>
  File "/usr/lib/python2.6/dist-packages/hulahop/{{{}}}.py", line 56, in startup
    from xpcom import components
ImportError: No module named xpcom

Ubuntu dropped the ball on this one. Due to a bug in epiphany, Ubuntu removed even the option to install and use python-xpcom (really lame, no style points for this one, Buh!).

You can try the xpcom build from the xpcom-ubuntu-9.10.tar.gz package.

Alternatively, you have to build it yourself. Unfortunately this means building xulrunner, which takes a lot of time and disk space (3 GB!). Here is a quick way to utilize a quad-core processor in the build process:

$ apt-get source xulrunner-1.9.1
$ cd xulrunner-1.9.1-
$ sudo apt-get build-dep xulrunner-1.9.1
$ dpkg-buildpackage -rfakeroot -b -uc -j4

The `4` in the `-j4` specifies the number of processors to use. This command builds a couple of packages, but we don't need them, they are identical to the ones in the Ubuntu archive. What we want is in the build tree that is left behind. You can install the xpcom package anywhere where python can find it. If you set the `$PYTHONPATH` as above, the following installs it inside the pyjamas directory:

$ cp -rL  debian/tmp/usr/lib/xulrunner- $PYTHONPATH

That's it! Now the `python` command from above should work.

Many people do not run "python" followed by "python install". This results in the errors and workarounds, below. It is a complete pain to run these workarounds, so it is best to actually do a system-wide install. There are however limitations of doing a system-wide install in this way (especially if doing development on pyjamas itself, or the installation is intended for multiple users) so below is actually a good workaround for doing "isolated sandbox" installs, that do not require root access and will also have no impact on any other users.

To run pyjamas-desktop, we have to set the python path to the pyjamas library, so pyjd can find it:

pyjamas$ export PYTHONPATH=`pwd`

Otherwise you get an error:

pyjamas/examples/helloworld$ python 
Traceback (most recent call last):
  File "", line 1, in <module>
    import pyjd # this is dummy in pyjs.
ImportError: No module named pyjd

Other examples use the UI libraries. For these, you also need to add the `library/` directory in the pyjamas directory to `PYTHONPATH`.


Ha, it could be as simple as

$ sudo apt-get install libboost-python1.38-dev

But if you followed the above you know what's coming. If you build V8 and PyV8 eventually this breaks with:

AttributeError: 'Boost.Python.StaticProperty' object attribute '{{{}}}' is read-only

Bug details

So instead we need to use a fixed boost package. Instead of building your own (even 1.40 is not good enough), just install it from ajmitch's PPA repository.

For this, add this to apt sources.list:

deb karmic main 
deb-src karmic main 

And then do a apt-get update/upgrade cycle (make sure libboost-python1.38-dev is installed).

"Instructions" (haha) are hidden at:

But don't bother, it's not this simple. G++ 4.4 (the Ubuntu) default doesn't work, the latest SVN repository of V8 is too new for current PyV8, you need special flags for x64 architecture and so on and so forth. Just do this (for x64, for another architecture you are on your own):

$ mkdir v8
$ cd v8
v8$ svn checkout -r 3167 v8
v8$ cd v8
v8/v8$ CC=gcc-4.3 CXX=g++-4.3 CCFLAGS=-fPIC scons arch=x64
v8/v8$ export V8_HOME=`pwd`
v8/v8$ cd ..

v8$ svn checkout pyv8
v8$ cd pyv8
v8/pyv8$ CXX=g++-4.3 CC=gcc-4.3 python build
v8/pyv8$ CXX=g++-4.3 CC=gcc-4.3 python install --prefix `pwd`/../pyv8-install
v8/pyv8$ cd ..
v8$ PYTHONPATH=$PYTHONPATH:`pwd`/pyv8-install/lib/python2.6/site-packages

Based on information at:

In `pyjamas/examples/libtest`, follow the README.

For me, this fails, with various issues, but none related to actually finding PyV8.

By now you have lost your hair, your humour, and probably your interest. In a couple of month though all these problems will be replaced by new ones! Have fun.

Something went wrong with that request. Please try again.