/ wxPython

Installing wxPython 4.0 (Project Phoenix) on Fedora 27

I've stayed away from wxPython in the past because updates were slow and Python 3 wasn't supported. Within the last couple of weeks, 4.0 was completed, which at least answers the Python 3 problem. I've been pounding my head against X11 idiosyncracies all weekend, so I thought I'd take a break and try it out.

Dependencies

It looks like the prequisites were sourced from Debian.

$ sudo dnf install -y {dpkg,freeglut,gstreamer{,1}-plugins-ba{se,d-free},gtk3,lib{jpeg,notify,SM,tiff},python{2,3},SDL}{,-devel} @development-tools
sudo dnf install -y dpkg dpkg-devel freeglut freeglut-devel gstreamer-plugins-base gstreamer-plugins-base-devel gstreamer-plugins-bad-free gstreamer-plugins-bad-free-devel gstreamer1-plugins-base gstreamer1-plugins-base-devel gstreamer1-plugins-bad-free gstreamer1-plugins-bad-free-devel gtk3 gtk3-devel libjpeg libjpeg-devel libnotify libnotify-devel libSM libSM-devel libtiff libtiff-devel python2 python2-devel python3 python3-devel SDL SDL-devel @development-tools

Feel free to skip ahead; the tangent is here because it's funny.

Tangent

One of the primary dependencies, libwebkitgtk-3.0, hasn't been updated for over a year (in the official repos). If you want, you can install that via something like this:

$ sudo dnf install https://rpmfind.net/linux/fedora/linux/releases/26/Everything/x86_64/os/Packages/w/webkitgtk3-2.4.11-5.fc26.x86_64.rpm

However, the prerequisites ask for some newer files, so I'd recommend building from source. Get a fresh release from the source and follow the build instructions. There are, unsurprisingly, a plethora of additional dependencies.

$ sudo dnf install -y ninja-build gperf {geoclue2,gobject-introspection,gtk2,hyphen,lib{secret,soup,tasn1,webp,xslt},sqlite}{,-devel}
sudo dnf install -y ninja-build gperf geoclue2 geoclue2-devel gobject-introspection gobject-introspection-devel gtk2 gtk2-devel hyphen hyphen-devel libsecret libsecret-devel libsoup libsoup-devel libtasn1 libtasn1-devel libwebp libwebp-devel libxslt libxslt-devel sqlite sqlite-devel

I had a really strange issue with libEGL.so.1.0.0 being missing. There were some good threads that sent me down some rabbit trails. I ended up relinking the file because I can't for the life of me figure out why it wasn't rebuilding.

$ symlinks /usr/lib64/ | grep EGL
dangling: /usr/lib64/libEGL.so -> /usr/lib64/libEGL.so.1.0.0
$ sudo ln -sf /usr/lib64/libEGL.so.1 /usr/lib64/libEGL.so

I actually did these steps first. I discovered each of those extra dependencies above the hard way.

$ curl -fLO https://www.webkitgtk.org/releases/webkitgtk-2.18.6.tar.xz
$ tar -xf webkitgtk-2.18.6.tar.xz
$ cd webkitgtk*
$ cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja
$ ninja
$ sudo ninja install

It took my machine about an hour to build (13:03-13:55). So much for a quick and simple distraction.

screenshot.1518377055

It also consumes a substantial amount of storage to build. When you're done, don't forget to nuke the build directory.

$ cd ..
$ du webkitgtk-2.18.6 | sort -rh | head -1
25G webkitgtk-2.18.6
$ rm -rf webkitgtk*

Of course, immediately after I did that, I learned why I couldn't find webkitgtk3. It's because webkitgtk4 is in the repos. And a newer release to boot.

Back on Track

$ sudo dnf install webkitgtk4{,-jsc}{,-devel} webkitgtk4-plugin-process-gtk2
sudo dnf install webkitgtk4 webkitgtk4-devel webkitgtk4-jsc webkitgtk4-jsc-devel webkitgtk4-plugin-process-gtk2

Once that's done, you should be able to install wxPython via pip.

$ pip install --user wxpython
$ pip list --format=columns | grep wxPython
wxPython 4.0.1

Having spent two hours installing this (when it should have taken 30 minutes), I think I'm done with wxPython for the day. More later, most likely.

Caveat

I might have already installed some of the necessary dependencies and missed them. I did most of an installation in Vagrant before I ran out of memory (wxPython also pegs things out). But actually having webkitgtk4 accessible in the repos made a world of difference.

Full Dependency List

Some of these might be unnecessary, e.g. you might not need Python 2 unless you work with it.

@development-tools
dpkg
dpkg-devel
freeglut
freeglut-devel
gstreamer-plugins-bad-free
gstreamer-plugins-bad-free-devel
gstreamer-plugins-base
gstreamer-plugins-base-devel
gstreamer1-plugins-bad-free
gstreamer1-plugins-bad-free-devel
gstreamer1-plugins-base
gstreamer1-plugins-base-devel
gtk3
gtk3-devel
libjpeg
libjpeg-devel
libnotify
libnotify-devel
libSM
libSM-devel
libtiff
libtiff-devel
python2
python2-devel
python3
python3-devel
SDL
SDL-devel
webkitgtk4
webkitgtk4-devel
webkitgtk4-jsc
webkitgtk4-jsc-devel
webkitgtk4-plugin-process-gtk2

The old wxPython logo is licensed under CC BY-SA 3.0. The new logo doesn't include a similar CC license in the repo but, at bare minimum, is covered by the wxWindows Library Licence. Stay awesome.

CJ Harries

I did a thing once. Change "blog." to "cj@" and you've got my email. All these opinions are mine and might not be shared by clients or employers.

Read More