wxPython build problem

Rick Knight wrote:

Robin Dunn wrote:

Rick Knight wrote:

Help. I'm trying to build wxPython on Slackware-9.0. I've downloaded versions 2.5.3.1, 2.5.1.5 and 2.4.2.4. Everything goes fine until I try to build wxPython with "python setup.py install" or "python setup.py build_ext --inplace --debug". Every time I get an error and the build aborts. I've attached a log of the build in bz2 format. Can anyone tell me what to do to get this to build?

My guess is that the wxPython build is trying to use an older version of wxWidgets.

What configure flags did you use when building wxWidgets?

What is the output of the following commands:

    which wx-config
    wx-config --version
    wx-config --list
    wx-config --cxxflags
    wx-config --libs

Thanks Robin for yor reply,

I'm trying to build the wxPython that's included with wx-widgets in wxPython-2.5.3.1. (I've also tried 2.5.1.5 and 2.4.2.4 with similar results) The configure flags I'm using are "--prefix=/opt/wx --with-gtk --with-opengl --disable-monolithic".

Output of which wx-config is
/usr/local/bin/wx-config

This is the problem. You have an older version of wxWidgets installed
in /usr/local and it is being used instead of the one in /opt/wx which
is what you specified in your configure step.

You can either add /opt/wx/bin to your PATH such that it is found before
/usr/local/bin, or you can tell setup.py to use the correct version by
adding "WX_CONFIG=/opt/wx/bin/wx-config" to the command line.

There is also another option: unless you need to have the other version
of wxWidgets for some reason just reconfigure wxWidgets to use a
/usr/local prefix and bebuild and reinstall it and overwrite the one you
have in /usr/local.

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Richard W. Knight wrote:

Robin,

I'm still having problems with this. I was finally able to get wxWidgets and wxPython to install, but the two apps I have that use them, wx-console for bacula and btdownloadgui.py for BitTorrent, would not work. Wx-console did work with a much earlier version of wxGTK+, btdownloadgui.py has never worked. Doing some googling, it seems the problem is in wxWidgets' use of private symbols in gtk and the solution is to get the latest wxWidgets for CVS and build against the latest GTK+.

That problem was resolved long before the 2.5.3.1 tarball was made, so that version of wxGTK should work fine. What are the actual errors you are getting when running those apps?

So, i've downloaded wxWidgets from cvs and built it according to the instructions included with the download. wxWidgets builds and installs fine, but I still cannot get wxPython to build correctly. Everytime I try to build it, it hangs on one of the contribs. First it was OGL, so I built it with BUILD_OGL=0, then it was STC so I built with BUILD_STC=0 BUILD_OGL=0. I finally gave up when the build failed on gizmos.

Did you build/install those contribs? If so, what are the errors?

Robin, below is the output of /usr/bin/btdownloadgui.py.

Traceback (most recent call last):
  File "/usr/bin/btdownloadgui.py", line 263, in run
    app = btWxApp(0, params)
  File "/usr/bin/btdownloadgui.py", line 250, in __init__
    wxApp.__init__(self, x)
  File "/usr/lib/python2.2/site-packages/wx-2.5.3-gtk2-unicode/wx/_core.py", line 5301, in __init__
    self._BootstrapApp()
  File "/usr/lib/python2.2/site-packages/wx-2.5.3-gtk2-unicode/wx/_core.py", line 4980, in _BootstrapApp
    return _core_.PyApp__BootstrapApp(*args, **kwargs)
  File "/usr/bin/btdownloadgui.py", line 254, in OnInit
    d = DownloadInfoFrame(doneflag)
  File "/usr/bin/btdownloadgui.py", line 109, in __init__
    colSizer.Add(50, 50, 0, wxEXPAND)
  File "/usr/lib/python2.2/site-packages/wx-2.5.3-gtk2-unicode/wx/_core.py", line 9136, in Add
    return _core_.Sizer_Add(*args, **kwargs)
TypeError: wxWindow, wxSizer, wxSize, or (w,h) expected for item

This is with the latest GTK+ and wxWidgets-2.5.3.1. All installed without error to prefix /usr .

Do I need to have an OGL application? and also a GIZMOS? I thought those were part of the wxWidgets package.

Thanks again,
Rick Knight

Robin Dunn wrote:

Richard W. Knight wrote:

Robin, below is the output of /usr/bin/btdownloadgui.py.

Traceback (most recent call last):
File "/usr/bin/btdownloadgui.py", line 263, in run
   app = btWxApp(0, params)
File "/usr/bin/btdownloadgui.py", line 250, in __init__
   wxApp.__init__(self, x)
File "/usr/lib/python2.2/site-packages/wx-2.5.3-gtk2-unicode/wx/_core.py", line 5301, in __init__
   self._BootstrapApp()
File "/usr/lib/python2.2/site-packages/wx-2.5.3-gtk2-unicode/wx/_core.py", line 4980, in _BootstrapApp
   return _core_.PyApp__BootstrapApp(*args, **kwargs)
File "/usr/bin/btdownloadgui.py", line 254, in OnInit
   d = DownloadInfoFrame(doneflag)
File "/usr/bin/btdownloadgui.py", line 109, in __init__
   colSizer.Add(50, 50, 0, wxEXPAND)
File "/usr/lib/python2.2/site-packages/wx-2.5.3-gtk2-unicode/wx/_core.py", line 9136, in Add
   return _core_.Sizer_Add(*args, **kwargs)
TypeError: wxWindow, wxSizer, wxSize, or (w,h) expected for item

IIRC, a newer version of bittorrent has fixed that error. It is using the old version of the sizer.Add method. In 2.4 both the old and the new were allowed, and in 2.5 the code has been reorganized somewhat and only the new is allowed. From the MigrationGuide:

"""
When adding a spacer to a sizer you now need to use a wx.Size or a 2-integer sequence instead of separate width and height parameters. This was optionally allowed in 2.4, but now it is required. This allows for more consistency in how you add the various types of items to a sizer. The first parameter defines the item (instead of the possibily first two, depending on if you are doing a spacer or not,) and that item can either be a window, a sizer or a spacer (which can be a sequence or a wx.Size.) Removing the option for separate width and height parameters greatly simplified the wrapper code.
"""

So that line should be changed to:

    colSizer.Add((50, 50), 0, wxEXPAND)

Robin,

I've rebuilt wxWidgets 2.5.3.1 and built OGL, STC & GIZMOS. No errors. When I run btdownloadgui.py this is what I get (I get the same error when building wxWidgets from CVS).

Traceback (most recent call last):
  File "/usr/bin/btdownloadgui.py", line 14, in ?
    from wxPython.wx import *
  File "/usr/lib/python2.2/site-packages/wxPython/__init__.py", line 20, in ?
    import wxc
ImportError: /usr/local/lib/libwx_gtk2u-2.4.so: undefined symbol: _gtk_accel_group_detach

I also have the latest GTK+. I thought the BitTorrent I'm using was the latest, but I'll check for something newer.

Thanks,
Rick Knight

Robin Dunn wrote:

Rick Knight wrote:
[...]

I also removed BitTorrent, downloaded the latest version, 3.4.2 and reinstalled it. When I try to run btdownloadgui.py this is what I get...

Traceback (most recent call last):
File "/usr/bin/btdownloadgui.py", line 263, in run
   app = btWxApp(0, params)
File "/usr/bin/btdownloadgui.py", line 250, in __init__
   wxApp.__init__(self, x)
File "/usr/lib/python2.2/site-packages/wx-2.5.3-gtk2-unicode/wx/_core.py", line 5340, in __init__
   self._BootstrapApp()
File "/usr/lib/python2.2/site-packages/wx-2.5.3-gtk2-unicode/wx/_core.py", line 5016, in _BootstrapApp
   return _core_.PyApp__BootstrapApp(*args, **kwargs)
File "/usr/bin/btdownloadgui.py", line 254, in OnInit
   d = DownloadInfoFrame(doneflag)
File "/usr/bin/btdownloadgui.py", line 109, in __init__
   colSizer.Add(50, 50, 0, wxEXPAND)
File "/usr/lib/python2.2/site-packages/wx-2.5.3-gtk2-unicode/wx/_core.py", line 9183, in Add
   return _core_.Sizer_Add(*args, **kwargs)
TypeError: wxWindow, wxSizer, wxSize, or (w,h) expected for item

What am I doing wrong?

Change line 109 in /usr/bin/btdownloadgui.py to:

    colSizer.Add((50, 50), 0, wxEXPAND)

(it just adds an extra set or parentheses) and send a patch to the BitTorrent project.

Robin,

Thanks for your help, and patience. Yor fix worked. I couldn't find a BitTorrent bugzilla or equivalent, so I sent an email to the BitTorrent_help list on Yahoo explaining the problem and showing the fix. I gave you credit for finding it, hope you don't mind.

Thanks again,
Rick Knight