Building wxPython 2.9.4.0 on Ubuntu

536 views
Skip to first unread message

Bruce Sherwood

unread,
Feb 21, 2013, 4:26:51 PM2/21/13
to wxpytho...@googlegroups.com
I'm trying to build wxPython 2.9.4.0 from source on 64-bit Ubuntu 12.10.

Here is what I executed:

cd wxPython-src-2.9.4.0/wxPython
sudo python2.7 build-wxpython.py --build_dir=../bld --install

The first thing that fails is that it doesn't find these two files:

package init file 'wx/lib/pubsub/pubsub2/__init__.py' not found (or not a regular file)
package init file 'wx/tools/XRCed/plugins/__init__.py' not found (or not a regular file)

I fixed this by copying wx/tools/XRCed/__init__.py (a dummy file) into wx/lib/pubsub/pubsub2/
and into wx/tools/XRCed/plugins/ and then restarted the build. The build fails like this:

...
running build_ext
building '_core_' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
creating build/temp.linux-x86_64-2.7/src/gtk
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DSWIG_TYPE_TABLE=_wxPython_table -DSWIG_PYTHON_OUTPUT_TUPLE -DWXP_USE_THREAD=1 -UNDEBUG -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -Iinclude -Isrc -I/usr/local/lib/wx/include/gtk2-unicode-2.9 -I/usr/local/include/wx-2.9 -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/python2.7 -c src/helpers.cpp -o build/temp.linux-x86_64-2.7/src/helpers.o -pthread -O3 -pthread
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
src/helpers.cpp:32:36: fatal error: wx/gtk/private/win_gtk.h: No such file or directory

There is in fact no directory wx/gtk/. The only directories under wx are build,
lib, py, and tools.

What do I need to do?

patrick korsnick

unread,
Feb 21, 2013, 6:52:14 PM2/21/13
to wxpytho...@googlegroups.com
Bruce, here's my build steps for building 2.9 on ubuntu:

This method can be used to build the development version (2.9) of wxPython on linux.

1) Install these pre-requisites:

opensuse 12.2
-------------
zypper in gtk2-devel freeglut-devel gstreamer-0_10-devel gstreamer-0_10-plugins-base-devel python-devel


Fedora 17
---------
yum install gtk2-devel freeglut-devel gstreamer-plugins-base-devel python-devel


Ubuntu 12.04 LTS
----------------
apt-get install g++ libgtk2.0-dev freeglut3-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev python-dev

 

2) Now on to building:

tar xf wxPython-src-2.9.4.0.tar.bz2

cd into the directory it creates

patch -p0 < wxPython-src-2.9.4.1.patch

cd wxPython

unset PYTHONPATH

python build-wxpython.py --build_dir=../bld

 

3) When it finishes building, add the directory it tells you to to the beginning of your PYTHONPATH environment variable. That's it!

Bruce Sherwood

unread,
Feb 21, 2013, 7:04:59 PM2/21/13
to wxpytho...@googlegroups.com
Thanks! I'll try it.


--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Robin Dunn

unread,
Feb 21, 2013, 8:50:57 PM2/21/13
to wxpytho...@googlegroups.com
> cc1plus: warning: command line option �-Wstrict-prototypes� is valid for
> C/ObjC but not for C++ [enabled by default]
> src/helpers.cpp:32:36: fatal error: wx/gtk/private/win_gtk.h: No such
> file or directory
>
> There is in fact no directory wx/gtk/. The only directories under wx are
> build,
> lib, py, and tools.

That path is relative to the wxWidgets include folder, not something in
wxPython.

>
> What do I need to do?

You need to apply the 2.9.4.1 patch that is in the wxPython download
area on SourceForge.


--
Robin Dunn
Software Craftsman
http://wxPython.org

Bruce Sherwood

unread,
Feb 23, 2013, 12:02:47 PM2/23/13
to wxpytho...@googlegroups.com
I successfully built wxPython 2.9.4.0 on a fresh install of Ubuntu 12.10. After applying the patch, I also had to do the following or else the build hung:
 
 Copy the dummy file wxPython-src-2.9.4.0/wxPython/wx/lib/pubsub/__init__.py into
wxPython-src-2.9.4.0/wxPython/wx/lib/pubsub/pubsub2/ and also into 
wxPython-src-2.9.4.0/wxPython/wx/tools/XRCed/plugins/

I then executed in wxPython "sudo python2.7 build-wxpython.py --build_dir=../bld --install".
 
After building, in /usr/local/lib/python2.7/dist-packages I found a wx-2.9.4-gtk2 folder, wx.pth pointing to that folder, and inside that folder a folder wx. In ADDITION, there is in dist-packages a folder wx whose contents are identical to the wx folder inside the wx-2.9.4-gtk2 folder! Does that make any sense?

Robin Dunn

unread,
Feb 23, 2013, 3:19:02 PM2/23/13
to wxpytho...@googlegroups.com
Not really. Is there any chance one of them was already there?

Bruce Sherwood

unread,
Feb 23, 2013, 3:48:01 PM2/23/13
to wxpytho...@googlegroups.com
No, there was absolutely for sure nothing in dist-packages before building. I'm quite sure of this because apparently I had successfully built previously but thought I'd failed in some way because there was this extra wx folder. So I deliberately deleted everything from dist-packages before building again from scratch (which included re-unpacking from the downloaded file).

Experimentally, I find that if I delete the wx folder everything still works. Strange.


--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

Robin Dunn

unread,
Feb 23, 2013, 4:05:42 PM2/23/13
to wxpytho...@googlegroups.com
Bruce Sherwood wrote:
> No, there was absolutely for sure nothing in dist-packages before
> building. I'm quite sure of this because apparently I had successfully
> built previously but thought I'd failed in some way because there was
> this extra wx folder. So I deliberately deleted everything from
> dist-packages before building again from scratch (which included
> re-unpacking from the downloaded file).
>
> Experimentally, I find that if I delete the wx folder everything still
> works. Strange.

Ok. IIRC I do some hackey stuff there to get the versioned subfolder so
maybe there are some Ubuntu customizations to distutils that are
confusing my tweaks, or vice-versa.

Bruce Sherwood

unread,
Feb 25, 2013, 8:40:45 PM2/25/13
to wxpytho...@googlegroups.com
This approach looks promising. It seems possible that my repeated difficulties may have been due to turning on the install flag for the build. For example, with the install flag present, the build locked up unless I first did this:

Copy the dummy file wxPython-src-2.9.4.0/wxPython/wx/lib/pubsub/__init__.py into
wxPython-src-2.9.4.0/wxPython/wx/lib/pubsub/pubsub2/ and also into 
wxPython-src-2.9.4.0/wxPython/wx/tools/XRCed/plugins/

WIthout the install flag, the build completes normally without doing this. 

But now I have questions prompted by my ignorance and confusion over Linux environment variables and/or what kind of shell environment I'm in when I'm in a terminal. Before doing the build I executed printenv and did not see a variable named PYTHONPATH. How exactly do I see this variable, and how exactly do I set and/or modify it? The end of the build also tells me to set LIB_LIBRARY_PATH, and I have no idea how to do that, either. Details gratefully accepted!

Bruce Sherwood

unread,
Feb 26, 2013, 12:03:34 AM2/26/13
to wxpytho...@googlegroups.com
I found out from a friend about using "export" to set the variables PYTHONPATH and LIB_LIBRARY_PATH each time I execute, but that I need to put these in .profile or .bashrc to make this permanent, and with this I was at last able to build and use wxPython on 64-bit Ubuntu 12.04. It seems cleaner to me to be able to tell people building VPython on Linux that for the wxPython part they can perform an install into a place already on the standard Python module search path.

So after the successful build I tried running (in the wxPython directory) 

   sudo python2.7 build-wxpython.py --build_dir=../bld --install

and to my great surprise it went through the entire compilation process again, despite having already compiled everything. Is there a statement that will just do the install appropriately, after a build that apparently on 64-bit Ubuntu 12.04 must be done without the --install directive?

Bruce Sherwood

unread,
Feb 26, 2013, 12:37:57 AM2/26/13
to wxpytho...@googlegroups.com
FYI, after the long install following the long build, I was told that that "you may need to set PYTHONPATH" to the build area, which is not necessary, whereas I was not told that I need to set LIB_LIBRARY_PATH to /usr/local/lib, without which libwx_gtk2u_adv-2.9.so.4 isn't found because it's in /usr/local/lib.

Boštjan Mejak

unread,
Feb 26, 2013, 3:46:51 AM2/26/13
to wxpytho...@googlegroups.com
Bruce, you mentioned .profile and .bashrc -- the first one is actually .bash_profile. Also, check out this awesome explanation here: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

Bruce Sherwood

unread,
Feb 26, 2013, 4:19:20 PM2/26/13
to wxpytho...@googlegroups.com
Thanks for the tip. On my 64-bit Ubuntu 12.04 there is a .profile and a .bashrc, but there is no file .bash_profile. Is .bash_profile something found only on other Linux distributions?


On Tue, Feb 26, 2013 at 1:46 AM, Boštjan Mejak <mejak...@gmail.com> wrote:
Bruce, you mentioned .profile and .bashrc -- the first one is actually .bash_profile. Also, check out this awesome explanation here: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.

Boštjan Mejak

unread,
Feb 26, 2013, 5:48:06 PM2/26/13
to wxpytho...@googlegroups.com
Bruce, try creating .bashrc file in /home/username directory and put stuff in there in the form of

export PYTHONPATH="/some/path"

Bruce Sherwood

unread,
Feb 26, 2013, 6:01:10 PM2/26/13
to wxpytho...@googlegroups.com
I did that, and it works. All I was commenting on was that there already existed files named .bashrc and .profile but there not a file named .bashrc_profile.


On Tue, Feb 26, 2013 at 3:48 PM, Boštjan Mejak <mejak...@gmail.com> wrote:
Bruce, try creating .bashrc file in /home/username directory and put stuff in there in the form of

export PYTHONPATH="/some/path"

--
You received this message because you are subscribed to a topic in the Google Groups "wxPython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/XWyd995Ci_Q/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to wxpython-user...@googlegroups.com.

Boštjan Mejak

unread,
Feb 26, 2013, 6:03:42 PM2/26/13
to wxpytho...@googlegroups.com
Not .bashrc_profile but .bash_profile ;)

Bruce Sherwood

unread,
Feb 26, 2013, 6:54:02 PM2/26/13
to wxpytho...@googlegroups.com
Oh, sorry. There's no .bash_profile either.


On Tue, Feb 26, 2013 at 4:03 PM, Boštjan Mejak <mejak...@gmail.com> wrote:
Not .bashrc_profile but .bash_profile ;)

Steve Barnes

unread,
Feb 27, 2013, 12:38:35 AM2/27/13
to wxpytho...@googlegroups.com
On 26/02/13 23:54, Bruce Sherwood wrote:
Oh, sorry. There's no .bash_profile either.


AFAIK It is not compulsory to have a .bash_profile, it gets executed IF it exists, but it will be created by the first user or package to need it.  I think that you could potentially have a system that doesn't have a .bashrc either but so many packages and other settings get stored there it is almost always already there when you look for it.
--
Steve Gadget Barnes

Robin Dunn

unread,
Feb 27, 2013, 9:09:09 PM2/27/13
to wxpytho...@googlegroups.com
Sarah Marques wrote:
> -----Mensagem original-----
> De: Boatjan Mejak<mejak...@gmail.com>
> Para: wxpytho...@googlegroups.com
> Data: Ter�a, 26 de Fevereiro de 2013 23:48
> Assunto: Re: [wxPython-users] Re: Building wxPython 2.9.4.0 on Ubuntu
>
> Bruce, try creating .bashrc file in /home/username directory and put stuff
> in there in the form of
>
> export PYTHONPATH="/some/path"
>
> What is the simplest and fastest way to install wxPython on ubuntu 10.4
> or 10.10?

If you want 2.8 then use the packages in the Ubuntu repositories. If
you want 2.9 then you'll need to build it yourself as is being discussed
in this thread. The wxPython/build-wxpython.py should be able to handle
the whole process for you, but it's got a few warts. See
wxPython/docs/BUILD.txt

Robin Dunn

unread,
Mar 2, 2013, 1:25:12 AM3/2/13
to wxpytho...@googlegroups.com
Sarah Marques wrote:

> Thanks Robin. 2.8 is ok for me, but I have already tried the instalation
> via apt-get and pip, but it fails, as some file is not resolved. Is
> there any specific repository I can manually add to apt lists, or
> something like that?

What errors do you get from apt-get?
Reply all
Reply to author
Forward
0 new messages