wxPython isn't on path in hardy beta

Bug #211553 reported by ben k
16
Affects Status Importance Assigned to Milestone
wxwidgets2.8 (Ubuntu)
Fix Released
Medium
Emilio Pozuelo Monfort
Hardy
Invalid
High
Emilio Pozuelo Monfort
Intrepid
Fix Released
Medium
Emilio Pozuelo Monfort

Bug Description

Binary package hint: python-wxgtk2.8

This bug don't permit to import wx. The bug is in python-wxgtk2.8 2.8.7.1-0ubuntu3 package. In intrepid this bug was fixed using upstream wx.pth and not a generated link. This SRU only edits how debian/rules manage the wx.pth files, so there is no a regression in it.

TEST CASE

PROCEDURE:
- install python-wxgtk2.8 package
- create a test.py file
- put in test.py file the following lines:

import wx
app = wx.PySimpleApp()
frame = wx.Frame(None, wx.ID_ANY, "Hello World!")
frame.Show(True)
app.MainLoop()

- type in terminal "python test.py"

RESULT ON PASS:
Should appear a gtk window with "Hello World!" as title.

RESULT ON FAIL:
Terminal will return this error:

Traceback (most recent call last):
  File "test.py", line 1, in <module>
    import wx
ImportError: No module named wx

END TEST CASE

Revision history for this message
ben k (bskaplan14) wrote :

This was actually either an issue with the upgrade, or an issue going from the package in the wxPython repository for Gutsy to the official Ubuntu package. Although reinstalling the package didn't do anything, it did correct itself when I completely removed the package and then installed it again.

Revision history for this message
Josto (joe-stolberg) wrote :

I can confirm this bug. It's the same for the hardy Release Version.

Revision history for this message
rvdb (rvdboomgaard) wrote :

i had the same problem after upgrading from 7.10 to 8.04

it seems like wx.pth isn't put in the python 2.5 version. After the command:

sudo cp /usr/lib/python2.4/site-packages/wx.pth /usr/lib/python2.5/site-packages/wx.pth

i could start python and import wx again

(btw the wx.pth is the way to set the standard wx version: so i think it is equivalent to import wxversion; wxversion.select('2.8'))

Revision history for this message
E. Gaudrain (egaudrain) wrote :

I had a similar problem in the Release Version of Hardy. But the file wx.pth was actually present in the python2.5/site-packages directory (and pointing to the correct location) but it was impossible to import wx. I imported wxversion and typed wxversion.select('2.8'), and then everything worked fine, and still after log out/re-log in. Looks weird to me because nothing in wxversion seems to write anything in wx.pth or any other file...

However, I also forced the re-installation of the python-wx* packages. It seemed to have no effect but I may be wrong. Unfortunately I can't reproduce these different situation to check my impression.

Then, it seems to me that the wxversion.select() call solved my problem, eventhough I've no idea how is that possible... but, unfortunately, it cannot totally be ruled out that the re-installation of the python-wx* packages solved the problem.

Sorry for such a fuzzy report...

Revision history for this message
David Gaarenstroom (david-gaarenstroom) wrote :

I'm having the same problem on Hardy Heron (final), I was able to solve it using:

  sudo ln -snf /etc/alternatives/wx.pth /usr/lib/python2.5/site-packages/
  sudo ln -snf /etc/alternatives/wx.pth /usr/lib/python2.4/site-packages/

So that should perhaps be in the python-wxgtk install scripts...

Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

I'm working on this.

Changed in wxwidgets2.8:
assignee: nobody → d.filoni
status: New → In Progress
Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

The debdiff

Changed in wxwidgets2.8:
assignee: d.filoni → nobody
status: In Progress → Confirmed
Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

New debdiff (wrong changelog in the previous).

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

I've talked to Devid and he's going to fix this properly in debian/rules instead of postinst and prerm.

Changed in wxwidgets2.8:
assignee: nobody → d.filoni
importance: Undecided → Medium
status: Confirmed → Incomplete
Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

This is a gutsy version bug, I'm working to fix it.

Changed in wxwidgets2.8:
status: Incomplete → In Progress
Revision history for this message
David Gaarenstroom (david-gaarenstroom) wrote :

It cannot be a gutsy version bug. Maybe an upgrade from gutsy to hardy bug. I am using hardy and suffer from this problem since I upgraded. I did not have it before...

Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

For me it's a bug of gutsy version. In hardy, import wx works fine. I think there is a sort of incompatibility between gutsy and hardy version and I'm trying to fix this.

Revision history for this message
Jon Hourany (nexusx6) wrote :

I ran across this problem last night while trying to get my feet wet in wx. I'm using Kubuntu 8.04 and its a fresh install, I did not upgrade. Before I saw the bug on launchpad I had tried to do a re-install via apt-get, then a full un-install/install, and then trying different versions of wx that were in the repositories -- nothing had worked. Importing wxversions and then wx.select('2.8') like others have posted does fix the problem for me though.

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

/usr/lib/python2.5/site-packages/wx.pth is shipped with python-wxversion. It would be interesting to know why it's not there if you have it installed.

Revision history for this message
David Gaarenstroom (david-gaarenstroom) wrote :

Apparently it is shipped, but if you look closer, it does however point to ../../wx/python/wx.pth (from both /usr/lib/python2.[45]/site-packages/wx.pth). This is an invalid path, there is no /usr/lib/wx/, not for my installation at least.
So I am very curious why it would work for *anyone*.

Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

This will be fixed in the new version.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package wxwidgets2.8 - 2.8.8.0-0ubuntu1

---------------
wxwidgets2.8 (2.8.8.0-0ubuntu1) intrepid; urgency=low

  * New upstream version, based on the upstream tarball
    wxPython-src-2.8.8.0.tar.bz2, remove upstream debian dir (LP: #244355).
  * Add debian/watch file, LP: #242164.
  * Edit get-orig-source target to provide a .orig.tar.gz with the same md5 for
    each .orig.tar.gz generated.
  * debian/rules: remove get-orig-source from .PHONY target.
  * debian/control.in: add python-wxtools in python-wxgtk=V=U Suggests field.
  * Do not apply fix_from_upstream_svn_r52465 patch, not needed.
  * Regenerate octave_oct, tcl_tk_tcl patches for the new version.
  * Fix spelling-error-in-description lintian warning.
  * Fix depends-on-obsolete-package lintian error.
  * Fix executable-not-elf-or-script lintian warnings.
  * Fix script-not-executable lintian warnings.
  * Fix missing-dependency-on-libc lintian error.
  * Fix dbg-package-missing-depends lintian warnings.
  * Fix package-contains-empty-directory lintian warnings.
  * Fix manpage-has-errors-from-man lintian warning.
  * Fix image-file-in-usr-lib lintian warnings:
    - add editra_pixmaps patch
    - add xrced_bitmaps patch
  * Fix unused-override lintian info.
  * Fix malformed-override lintian errors.
  * Fix extra-license-file lintian warnings.
  * Install upstream wx.pth instead of generated file links (LP: #211553).
  * Add editra.png, pyshell.png (encoded using uuencode) icons, LP: #236876:
    - debian/rules: use uudecode to decode .png icons.
  * Add a new pyshell.xpm icon.
  * Fix doc-base-file-references-missing-file lintian error.
  * Fix doc-base-unknown-section lintian warning.
  * Fix ruby-script-but-no-ruby-dep lintian errors.
  * Fix wish-script-but-no-wish-dep lintian errors.
  * Fix missing-dep-for-interpreter errors.
  * Bump Standards-Version to 3.8.0.

 -- Devid Filoni <email address hidden> Mon, 30 Jun 2008 22:02:17 +0200

Changed in wxwidgets2.8:
status: In Progress → Fix Released
Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

The debdiff for hardy (hardy-proposed). I tested it in my PC ant it works properly.

description: updated
description: updated
description: updated
description: updated
Changed in wxwidgets2.8:
assignee: d.filoni → nobody
status: Fix Released → Confirmed
Revision history for this message
Scott Kitterman (kitterman) wrote : Re: [Bug 211553] [NEW] wxPython isn't on path in hardy beta

Was it in the default path in the past?

Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

It was, but it didn't work as you can see in the previous comments.

Changed in wxwidgets2.8:
status: Confirmed → Fix Released
Changed in wxwidgets2.8:
status: New → Confirmed
Changed in wxwidgets2.8:
status: Confirmed → New
Revision history for this message
Luca Falavigna (dktrkranz) wrote :

Did you make some tests on packages to see how your change interacts with them? wxwidgets2.8 is a large library and we should avoid bringing regressions in a LTS.

Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

Oh, sure. python-wxgtk2.8 also continue to depends on python-wxversion and this is needed to maintains "compatibility".

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

I'm re-fixing this issue as installing /usr/lib/python2.X/site-packages/wx.pth as a regular file makes it impossible for python-wxgtk2.6 to use the alternatives system to provide the wx python module when python-wxgtk2.8 isn't installed.

See bug #274619

Changed in wxwidgets2.8:
assignee: nobody → pochu
status: Fix Released → Fix Committed
Revision history for this message
David Gaarenstroom (david-gaarenstroom) wrote :

Re-fixing? It has never been fixed for Ubuntu 8.04 "Long Time Support" and thus wxWidgets apps still don't work out-of-the-box and still need the "import wxversion" workaround... Apparently all Hardy supplied wxWidgets applications are using this workaround, or else they would not work AFAIK. It is best to use the wxWidgets repository for hardy:
deb http://apt.wxwidgets.org/ hardy-wx main

Revision history for this message
Emilio Pozuelo Monfort (pochu) wrote : Re: [Bug 211553] Re: wxPython isn't on path in hardy beta

David Gaarenstroom wrote:
> Re-fixing?

Yes, in Intrepid.

> It has never been fixed for Ubuntu 8.04 "Long Time Support"
> and thus wxWidgets apps still don't work out-of-the-box and
> still need the "import wxversion" workaround...

I'll try to have a look at it

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package wxwidgets2.8 - 2.8.8.0-0ubuntu2

---------------
wxwidgets2.8 (2.8.8.0-0ubuntu2) intrepid; urgency=low

  * debian/python-wxgtk.postinst,
    debian/python-wxgtk.prerm,
    debian/rules:
    - Switch back to update-alternatives for python-wxgtk2.8, so that
      python-wxgtk2.6 can work when python-wxgtk2.8 isn't installed
      (see #274619). Re-fixes lp: #211553.

 -- Emilio Pozuelo Monfort <email address hidden> Mon, 13 Oct 2008 14:35:07 +0200

Changed in wxwidgets2.8:
status: Fix Committed → Fix Released
Revision history for this message
Devid Antonio Filoni (d.filoni) wrote :

Emilio, can you make a debdiff for hardy? (and thanks for properly fixing this :) )

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

Ok, I've investigated this a bit in Hardy.

David Gaarenstroom wrote:
> Re-fixing? It has never been fixed for Ubuntu 8.04 "Long Time Support"
> and thus wxWidgets apps still don't work out-of-the-box and still need
> the "import wxversion" workaround...

I've just installed python-wxgtk2.8 in a Hardy system (not upgraded from Gutsy)
and importing wx works just fine. So this is not an issue for clean installs
(and you can read that in the bug report too).

> Apparently all Hardy supplied wxWidgets applications are using this
> workaround, or else they would not work AFAIK.

Not really. None of them do (or at least not to workaround this issue). It's in
a few systems where python-wxgtk is broken, and discovering what is causing it
would be a good start (it's not clear to me what's causing it from reading the
report - it's some upgrade issues, but I wonder if it happens for every
gutsy->hardy installation, or for dapper->hardy, or only for people who have
used wxwidgets from wxwidgets.org.

> It is best to use the wxWidgets repository for hardy:
> deb http://apt.wxwidgets.org/ hardy-wx main

That could in fact be the cause of this bug.

AHA!! s/could in fact be/IS/g

I've added that repo to this hardy installation, and upgraded python-wxgtk2.8
(and python-wxversion and libwx{gtk,base}2.8) to the packages from
apt.wxwidgets.org. Importing wx was still working.

Then I've downgraded to the version in Hardy, and it was broken. Why? Because
python-wxgtk2.8 from wxwidgets.org have regular files in
/usr/lib/python2.X/site-packages/wx.pth, but the Ubuntu packages have symlinks
(we need to have it that way to support multiple wx versions).

So I blame wxwidgets.org packages and close the bug as Invalid. Next time think
twice before adding external repositories ;-)

Oh, and reinstalling python-wxversion should fix the issue.

BTW, Devid: I think your debdiff for Hardy was wrong because it would have
'broken' python-wxgtk2.6 (broken as in installing python-wxgtk2.6 provides wx
module, installing your python-wxgtk2.8 provides wx module too, removing
python-wxgtk2.8 no longer provides wx module from python-wxgtk2.6, because it
has removed /usr/lib/python2.X/site-modules/wx.pth which was a regular file in
python-wxgtk2.8).

Changed in wxwidgets2.8:
assignee: nobody → pochu
importance: Undecided → High
status: New → Invalid
Revision history for this message
David Gaarenstroom (david-gaarenstroom) wrote :

Well, I'll try to be polite, but if you could actually take the time to read...
- This bug is not caused by the apt.wxwidgets.org version, it was solve by using it, but that repository has nothing to do with this bug report!
- I get this problem when upgrading from gutsy, as well as a clean hardy install. When I say clean, I mean clean: out of the box, direct from a 8.04 live CD installed and apt-get install python-wxgtk2.8.
- Please unpack the .deb, e.g. from http://packages.ubuntu.com/hardy/python-wxgtk2.8, you will see there that it's simply not there, "postinst":

update-alternatives --install /usr/lib/wx/python/wx.pth wx.pth \
                              /usr/lib/wx/python/wx2.8.pth 28

Now YOU point me where it is linking /usr/lib/python2.5/site-packages/wx.pth to something.

By the way, postinst is using "/bin/sh" as shell, which for me is /bin/dash, but that does not seem related.

Revision history for this message
David Gaarenstroom (david-gaarenstroom) wrote :

Changing to incomplete, will again reinstall 8.04 live CD to a clean VM and post my findings

Changed in wxwidgets2.8:
status: Invalid → Incomplete
Revision history for this message
David Gaarenstroom (david-gaarenstroom) wrote :

Upgrading from gutsy (live-CD based, with python-wxgtk2.8) to hardy seems to does have the problem.
Clean hardy (live-CD) (many package installs) then apt-get install python-wxgtk2.8 (no other installs before that) does somehow...
Clean hardy (live-CD) then apt-get install python-wxgtk2.8 does not have the problem.
Clean hardy (live-CD) apt-get install python-wxgtk2.8 then many package installs does not have the problem.

Good enough for me.

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

David Gaarenstroom wrote:
> - This bug is not caused by the apt.wxwidgets.org version, it was solve by using it,
> but that repository has nothing to do with this bug report!

At least it is related, as I got this bug by upgrading from packages in that
repository to the official packages. But it may be a different issue with the
same consequence.

> - I get this problem when upgrading from gutsy, as well as a clean hardy install.
> When I say clean, I mean clean: out of the box, direct from a 8.04 live CD
> installed and apt-get install python-wxgtk2.8.

I can't reproduce this at all in a Hardy install by installing python-wxgtk2.8,
nor a combination of python-wxgtk2.8 and python-wxgtk2.6. It's not an upgrade
from Gutsy.

I've installed the Gutsy official (from the Ubuntu repositories) packages in
that hardy installation, importing wx worked fine, then upgraded to the Hardy
Ubuntu packages (to test the upgrade scripts) and it was still working fine, and
the symlinks were correct.

> - Please unpack the .deb, e.g. from http://packages.ubuntu.com/hardy/python-wxgtk2.8,
> you will see there that it's simply not there, "postinst":
>
> update-alternatives --install /usr/lib/wx/python/wx.pth wx.pth \
> /usr/lib/wx/python/wx2.8.pth 28
>
> Now YOU point me where it is linking /usr/lib/python2.5/site-
> packages/wx.pth to something.

It's in python-wxversion, and python-wxgtk2.8 depends on it.

>
> By the way, postinst is using "/bin/sh" as shell, which for me is
> /bin/dash, but that does not seem related.
>

It is not.

David Gaarenstroom wrote:
> Upgrading from gutsy (live-CD based, with python-wxgtk2.8)
> to hardy seems to does have the problem.

Weird, I'll have to test a complete install of Gutsy & upgrade to Hardy.
But if you have it at hand, could you let me know the output of these commands?

ls -l /usr/lib/python2.*/site-packages/wx.pth
ls -l /usr/lib/wx/python/
ls -l /etc/alternatives/wx.pth
cat /usr/lib/wx/python/wx2.8.pth
dpkg -l | grep python-wx
apt-cache madison python-wxgtk2.8
apt-cache policy python-wxgtk2.8

> Clean hardy (live-CD) (many package installs) then apt-get
> install python-wxgtk2.8 (no other installs before that) does somehow...
> Clean hardy (live-CD) then apt-get install python-wxgtk2.8
> does not have the problem.
> Clean hardy (live-CD) apt-get install python-wxgtk2.8 then
> many package installs does not have the problem.

Do you mean that if you install python-wxgtk2.8 in a clean install, importing wx
from python works fine, but if you install it after installing lots of packages,
importing wx does not work?

If so, what packages did you install before installing python-wxgtk2.8 to
trigger the problem?

Thanks for your help.

Revision history for this message
Hajex (hajex) wrote :

Hi everyone,
I have hardy 8.04 and I faced the same problem . and I tried different ways and editors.
I try to reinstall many times but nothing wor
Finally I tested same wx code in shell , IDLE , wings and eclipse ..
the code was working only in eclipse .. please try that ..
I dont find any other solution except switching to eclipse
may be the problem in editor or may be because I choose the interpreter as (/usr/bin/python2.5) instead of (/usr/bin/python)
I hope someone else tries and tell me what he get..

Cheers.

Changed in wxwidgets2.8 (Ubuntu Hardy):
status: Invalid → Confirmed
status: Confirmed → Invalid
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.