Missing link /usr/lib/wx/python/wx.pth

Bug #300008 reported by Trevor King
4
Affects Status Importance Assigned to Milestone
wxwindows2.4 (Ubuntu)
Triaged
Medium
Emilio Pozuelo Monfort
Hardy
Won't Fix
Undecided
Unassigned

Bug Description

I was having trouble installing wx for python 2.5 on Hardy Heron.

1)
$ lsb_release -rd
Description: Ubuntu 8.04.1
Release: 8.04

2)
$ apt-cache policy python-wxversion
python-wxversion:
  Installed: 2.8.7.1-0ubuntu3
  Candidate: 2.8.7.1-0ubuntu3
  Version table:
 *** 2.8.7.1-0ubuntu3 0
        500 http://us.archive.ubuntu.com hardy/universe Packages
        100 /var/lib/dpkg/status

I installed/uninstalled assorted wx related packages via aptitude, so it's possible the problem is due to another package and not python-wxversion. After installation
  $ /usr/bin/python2.4
  >>> import wx
worked, but it failed in python 2.5
  $ python
  Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
  [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import wx
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  ImportError: No module named wx

Trying to figure out why, I noticed a dead link:
  $ ls -l /usr/lib/python2.5/site-packages/wx.pth
  lrwxrwxrwx 1 root root 22 2008-11-19 12:20 /usr/lib/python2.5/site-packages/wx.pth -> ../../wx/python/wx.pth
while the 2.4 link is
  $ ls -l /usr/lib/python2.4/site-packages/wx.pth
  lrwxrwxrwx 1 root root 24 2008-11-19 12:20 /usr/lib/python2.4/site-packages/wx.pth -> /etc/alternatives/wx.pth
  $ ls -l /etc/alternatives/wx.pth
  lrwxrwxrwx 1 root root 28 2008-11-19 12:23 /etc/alternatives/wx.pth -> /usr/lib/wx/python/wx2.8.pth
and wx2.8.pth is a real file (contents: wx-2.8-gtk2-unicode)

Solution:
Whichever package (presumably python-wxversion) sets these links up needs to redirect the 2.5 wx.pth to '/etc/alternatives/wx.pth'.

Revision history for this message
Emilio Pozuelo Monfort (pochu) wrote :

Hi Trevor, and thanks for your report.

I've tried to reproduce this but I can't.

The right symlink is actually from /usr/lib/python2.X/site-packages/wx.pth to /usr/lib/wx/python/wx.pth (the python2.5 one). Then, /usr/lib/wx/python/wx.pth should point to /etc/alternatives/wx.pth, which will point to /usr/lib/wx/python/wx2.?.pth

Can you check where /usr/lib/wx/python/wx.pth points to in your system?
Is this an upgrade from a previous Ubuntu release, or did you install it from scratch?
Have you ever installed wxwidgets deb packages from wxwidgets.org?

Changed in wxwidgets2.8:
importance: Undecided → Medium
status: New → Incomplete
Revision history for this message
Trevor King (wking-drexel) wrote :
Download full text (13.6 KiB)

Hmm, I just bounced to emails. Do we have to use the web interface? Anyhow, I've reproduced the bug in a script:

From: "W. Trevor King"
To: Bug 300008 <email address hidden>
Cc:
Bcc:
Subject: Re: Missing link /usr/lib/wx/python/wx.pth
Reply-To:
In-Reply-To: <email address hidden>

On Wed, Nov 26, 2008 at 09:49:48PM +0000, Emilio Pozuelo Monfort wrote:
> I've tried to reproduce this but I can't.

It took me a bit of digging through my aptitude logs before I could too,
so I'm not supprised ;). Sorry I didn't think to check them earlier :p.

> The right symlink is actually from /usr/lib/python2.X/site-
> packages/wx.pth to /usr/lib/wx/python/wx.pth (the python2.5 one). Then,
> /usr/lib/wx/python/wx.pth should point to /etc/alternatives/wx.pth,
> which will point to /usr/lib/wx/python/wx2.?.pth

That's what I get after a good install, see screenlog.0 below.

> Can you check where /usr/lib/wx/python/wx.pth points to in your system?
> Is this an upgrade from a previous Ubuntu release, or did you install it from scratch?

I don't remember, but that's ok, reproduction below.

> Have you ever installed wxwidgets deb packages from wxwidgets.org?

No. Only Ubuntu packages for wxwidgets.

After digging through my aptitdue logs, I see that I was a bit
confused. I think I was trying to get `import wxWidgets' working in
python to get some old code going, not realizing that it should have
been `import wx'. Anyhow, a script reproducing my bug and a
screendump of it's output are attached.

The 2.4 install step somehow mangles the linking situation, setting up

ls: cannot access /usr/lib/wx/python/wx.pth: No such file or directory
/etc/alternatives/wx.pth -> /usr/lib/wx/python/wx2.8.pth
/usr/lib/python2.4/site-packages/wx.pth -> /etc/alternatives/wx.pth
/usr/lib/python2.5/site-packages/wx.pth -> ../../wx/python/wx.pth

Which persists through the remainder of the broken approach. A full
clear and reinstall without any 2.4 packages fixes the situation.

Hope that helps :)
Trevor

--------- begin wxlinks.sh ----------
#!/bin/bash
#
# reproduce
# https://bugs.launchpad.net/ubuntu/+source/wxwidgets2.8/+bug/300008

echo " --------- BROKEN APPROACH --------- "

echo "Clean"
sudo apt-get purge -my python-wxtools python-wxversion python-wxgtk2.8 libwxgtk2.8-0 wx-common libwxbase2.8-0 libwxgtk2.4-1 python-wxgtk2.4
ls -l /usr/lib/python2.{4,5}/site-packages/wx.pth /usr/lib/wx/python/wx.pth /etc/alternatives/wx.pth

echo -e "\nHalf install"
sudo apt-get install -y libwxbase2.8-0 libwxgtk2.8-0
ls -l /usr/lib/python2.{4,5}/site-packages/wx.pth /usr/lib/wx/python/wx.pth /etc/alternatives/wx.pth

echo -e "\n2.4 install"
sudo apt-get install -y python-wxversion python-wxgtk2.4 libwxgtk2.4-1 python-wxgtk2.8
ls -l /usr/lib/python2.{4,5}/site-packages/wx.pth /usr/lib/wx/python/wx.pth /etc/alternatives/wx.pth

echo -e "\n2.4 remove"
sudo apt-get purge -y python-wxgtk2.4 libwxgtk2.4-1
ls -l /usr/lib/python2.{4,5}/site-packages/wx.pth /usr/lib/wx/python/wx.pth /etc/alternatives/wx.pth

echo -e "\n2.8 install"
sudo apt-get install -y python-wxtools wx-common
ls -l /usr/lib/python2.{4,5}/site-packages/wx.pth /usr/lib/wx/pyt...

Revision history for this message
Trevor King (wking-drexel) wrote :

Oh, we can add attachments here

Revision history for this message
Trevor King (wking-drexel) wrote :
Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

Emilio, this bug is in hardy, I think you should work on a SRU, you've fixed this bug only in intrepid+.

Changed in wxwidgets2.8:
status: Incomplete → Fix Released
Revision history for this message
Emilio Pozuelo Monfort (pochu) wrote :

Trevor, thanks for the detailed explanation. I've now seen that the problem is in python-wxgtk2.4. It sets the wx.pth alternatives in a different way. While python-wxgtk2.4 and 2.6 use it to point /usr/lib/wx/python/wx.pth to wx2.?.pth, python-wxgtk2.4 does a totally different thing and uses it to link /usr/lib/python2.4/site-packages/wx.pth to /usr/lib/wx/python/wx2.?.pth, breaking it.

This likely affects Hardy, Intrepid and Jaunty, and perhaps even Gutsy and Dapper. But I think if we fix it, we should do it just in Hardy and beyond.

And there's just one package remaining to be transitioned to wxwidgets2.6 before we can remove wxwindows2.4 from the archive
https://wiki.ubuntu.com/MOTU/wx2.4Migration

Changed in wxwidgets2.8:
assignee: nobody → pochu
status: Fix Released → Triaged
Revision history for this message
Rolf Leggewie (r0lf) wrote :

Hardy has seen the end of its life and is no longer receiving any updates. Marking the Hardy task for this ticket as "Won't Fix".

Changed in wxwindows2.4 (Ubuntu Hardy):
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.