Monday, May 21, 2012

Installing Mypaint 1.0.0 step-by-step

Mypaint is an amazing digital painting software for Linux, Windows and Mac. I absolutely love it, but installing it on Slackware 13.37 was a bit tricky...


First of all, download and extract mypaint 1.0.0:
wget http://download.gna.org/mypaint/mypaint-1.0.0.tar.bz2
tar -xvf mypaint-1.0.0.tar.bz2
cd  mypaint-1.0.0

Now, if you take a look at the readme file
cat README

you'll see that it needs scons to compile. If you haven't installed scons don't panic, there is an easy to get SlackBuild:
cd ..
wget http://slackbuilds.org/slackbuilds/13.37/development/scons.tar.gz
tar -xvf scons.tar.gz
cd scons
wget http://downloads.sourceforge.net/scons/scons-2.1.0.tar.gz

as root:
./scons.SlackBuild
installpkg /tmp/scons-2.1.0-i486-1_SBo.tgz

Now you can try to install mypaint but if you are in the same situation I was, you'll get this error when trying to install it:
RuntimeError: pygtk was not compiled with Numeric Python support

We need numpy! And here comes slacky.eu:
cd ..
wget http://repository.slacky.eu/slackware-13.37/libraries/numpy/1.4.1/numpy-1.4.1-i686-3sl.txz

and, as root:
installpkg numpy-1.4.1-i686-3sl.txz

At this point you need to recompile pygtk so it will have Numeric Python support, and the easiest way is using the source package and the SlackBuild script coming from the Slackware's install CD/DVD or the online mirrors, so:
mkdir  pygtk
cd pygtk
wget ftp://ftp.heanet.ie/mirrors/ftp.slackware.com/pub/slackware/slackware-13.37/source/l/pygtk/pygtk-2.22.0.tar.bz2
wget ftp://ftp.heanet.ie/mirrors/ftp.slackware.com/pub/slackware/slackware-13.37/source/l/pygtk/pygtk.SlackBuild

(if this mirror isn't working you can find another one here)

as root:
chmod 777 pygtk.SlackBuild
./pygtk.SlackBuild
pkgtool

Now you should find and remove pygtk, so you will be ready to install the new one:
installpkg /tmp/pygtk-2.22.0-i486-1.txz

Ok, that was easy. But again, if you try to install and run mypaint at this point you will get another error ending like this:
if fp is not None: fp.close()
UnboundLocalError: local variable 'fp' referenced before assignment

ARRGH! Don't worry, I googled that for you. This can happen if you have an old version of swig (like the one that comes as default with Slackware 13.37):
~:$ swig -version
SWIG Version 1.3.38

Yep, that's it! Swig should be 2.0.4 at least. So let's get the right one! And oh, that's amazing, the original slackware SlackBuild script will work with newer versions too! Let's go:
cd ..
mkdir swig
cd swig
wget ftp://ftp.heanet.ie/mirrors/ftp.slackware.com/pub/slackware/slackware-13.37/source/d/swig/swig.SlackBuild
wget http://downloads.sourceforge.net/project/swig/swig/swig-2.0.6/swig-2.0.6.tar.gz?r=http%3A%2F%2Fwww.swig.org%2Fdownload.html&ts=1337625864&use_mirror=garr

and then... what? That's a tar.gz, not a tar.bz2! Let's fix it...
tar -xvf swig-2.0.6.tar.gz
tar cjf swig-2.0.6.tar.bz2 swig-2.0.6/

Done! Now, as root:
chmod 777 swig.SlackBuild
./swig.SlackBuild
pkgtool

Again, remove old swig (unless you need it) and install the new one:
installpkg /tmp/swig-2.0.6-i486-2.txz

That's it! Almost... now you can finally run scons to install mypaint, and since in slackware the default path for software is /usr, we will install specifying a prefix:
cd ..
cd  mypaint-1.0.0

and as root:
scons prefix=/usr install

Now if we try to start mypaint... ha! The last error:
~:$ mypaint
builtin python 2.6 json support
confpath = /home/username/.mypaint/
Error: Where have my icons gone?
Icon search path: ('/home/username/.icons', '/home/username/.local/share/icons', '/usr/local/share/icons', '/usr/share/icons', '/usr/local/share/pixmaps', '/usr/share/pixmaps', '/usr/share/icons')
Mypaint can't run sensibly without its icons; please check your installation.
see https://gna.org/bugs/?18460 for possible solutions

GROWL! Another bit of google-fu and the simple solution comes up, running as root:
~:# gtk-update-icon-cache -tf /usr/share/icons/hicolor/
gtk-update-icon-cache: Cache file created successfully.
~:#  chmod a+r /usr/share/icons/hicolor/icon-theme.cache

The neverending story ends here. Try to run mypaint and... yes! Works like a charm! Now you're free to grab your graphic tablet and enjoy. :)

2 comments:

  1. I found a different error:

    checking for PYGOBJECT... configure: error: Package requirements (pygobject-2.0 >= 2.21.3) were not met:

    Requested 'pygobject-2.0 >= 2.21.3' but version of PyGObject is 2.20.0

    ReplyDelete
  2. It's a bit disappointing that I have to recompile a major official package (pygtk) for this to work. Is there no other way to get this working on Slackware without recompiling pygtk?

    ReplyDelete