quickly crashed with ImportError in __main__: No module named quickly

Bug #850744 reported by Mafiosso
40
This bug affects 7 people
Affects Status Importance Assigned to Milestone
quickly (Ubuntu)
Fix Released
High
Barry Warsaw

Bug Description

quickly does not start by producing import errors

ProblemType: Crash
DistroRelease: Ubuntu 11.10
Package: quickly 11.09-0ubuntu1
ProcVersionSignature: Ubuntu 3.0.0-10.16-generic 3.0.4
Uname: Linux 3.0.0-10-generic i686
NonfreeKernelModules: wl
ApportVersion: 1.23-0ubuntu1
Architecture: i386
Date: Thu Sep 15 10:56:11 2011
ExecutablePath: /usr/bin/quickly
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release i386 (20101007)
InterpreterPath: /usr/bin/python2.7
PackageArchitecture: all
ProcCmdline: /usr/bin/python /usr/bin/quickly shell-completion quickly cre
ProcEnviron:
 SHELL=/bin/bash
 PATH=(custom, user)
 LANG=cs_CZ.UTF-8
PythonArgs: ['/usr/bin/quickly', 'shell-completion', 'quickly', 'cre']
SourcePackage: quickly
Title: quickly crashed with ImportError in __main__: No module named quickly
Traceback:
 Traceback (most recent call last):
   File "/usr/bin/quickly", line 34, in <module>
     from quickly import commands, configurationhandler, quicklyconfig, coreupgrade, templatetools, tools, version
 ImportError: No module named quickly
UpgradeStatus: Upgraded to oneiric on 2011-09-13 (1 days ago)
UserGroups: adm admin cdrom dialout lpadmin plugdev sambashare

Revision history for this message
Mafiosso (pavelvonlostice) wrote :
tags: removed: need-duplicate-check
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in quickly (Ubuntu):
status: New → Confirmed
Changed in quickly (Ubuntu):
importance: Undecided → High
visibility: private → public
Revision history for this message
Michael Terry (mterry) wrote :

I can't reproduce this. Neither on my development machine or a fresh install of 11.10. Any hints for reproducing?

Changed in quickly (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Brian Murray (brian-murray) wrote :

In ipython or python just using 'from quickly import tools' fails for me. Are these all the quickly related packages I am supposed to have installed?

ii python-quickly-common 11.09-0ubuntu1 build new apps quickly
ii python-quickly-core 11.09-0ubuntu1 build new apps quickly
ii python-quickly.widgets 11.08 Library for easing some PyGtk coding tasks
ii quickly 11.09-0ubuntu1 build new apps quickly
ii quickly-ubuntu-template 11.09-0ubuntu1 quickly ubuntu application template
ii quickly-widgets 11.08 Transitional package for python-quickly.widgets

Revision history for this message
Michael Blank (mblank) wrote :

quickly crashes after upgrade to 11.10 beta2. Error Message after calling "quickly ...":

  File "/usr/bin/quickly", line 34, in <module>
    from quickly import commands, configurationhandler, quicklyconfig, coreupgrade, templatetools, tools, version
ImportError: No module named quickly

Revision history for this message
Michael Terry (mterry) wrote :

Guh. So a fresh install doesn't hit it. Maybe it's an upgrade thing (that for some reason I didn't hit). I'll try upgrading 11.04 in a VM.

Revision history for this message
David Planella (dpm) wrote :

I can reproduce it on a system upgraded from Lucid -> Maverick -> Natty -> Oneiric as well. I'll be happy to help with testing if it's useful.

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Seems quite a lot of people are affected by this one.
doing:
sudo apt-get install python-quickly-common --reinstall

fixed this.
can it be due to the dh_python2 transition? Barry, any pick on that?

Revision history for this message
Michael Blank (mblank) wrote :

I did reinstall "python-quickly-common" (see post #8) - but now get this error, when running quickly:

$ quickly run
Traceback (most recent call last):
  File "bin/jotty", line 32, in <module>
    import jotty
  File "/home/mblank/jotty/jotty/__init__.py", line 14, in <module>
    from jotty import JottyWindow
  File "/home/mblank/jotty/jotty/JottyWindow.py", line 14, in <module>
    from jotty_lib import Window
  File "/home/mblank/jotty/jotty_lib/__init__.py", line 9, in <module>
    from . helpers import set_up_logging
  File "/home/mblank/jotty/jotty_lib/helpers.py", line 13, in <module>
    from . Builder import Builder
  File "/home/mblank/jotty/jotty_lib/Builder.py", line 8, in <module>
    from gi.repository import GObject # pylint: disable=E0611
  File "/usr/lib/python2.7/dist-packages/gi/__init__.py", line 23, in <module>
    from ._gi import _API, Repository
ImportError: could not import gobject (error was: ImportError('When using gi.repository you must not import static modules like "gobject". Please change all occurrences of "import gobject" to "from gi.repository import GObject".',))

Revision history for this message
Michael Blank (mblank) wrote :

this is the same problem as in bug #829186
(several python based software packages seem to have similar problems).

Revision history for this message
Barry Warsaw (barry) wrote :

The original bug is almost certainly a transition-to-dh_python2 problem. When I upgrade from Lucid to Oneiric, we lose /usr/lib/python2.{6,7}/dist-packages/quickly/__init__.py so Python doesn't read that as a package, and thus 'import quickly' fails. On a fresh install, i.e. where quickly always used dh_python2, the __init__.py exists.

I'll keep looking, so I don't yet know if this is a problem with uninstalling python-central (what quickly used to use) or a dh_python2 problem, or something else in the upgrade procedure.

Barry Warsaw (barry)
Changed in quickly (Ubuntu):
status: Incomplete → Confirmed
milestone: none → ubuntu-11.10
assignee: nobody → Barry Warsaw (barry)
Revision history for this message
Michael Blank (mblank) wrote :

building NEW quickly projects works fine, btw.

only "old" quickly projects do not run any longer. I think it would be sufficient if there was an "upgrade" path for quickly projects.

Revision history for this message
Barry Warsaw (barry) wrote :

I can't yet tell exactly where the problem is, but I've confirmed in a chroot that upgrading quickly causes /usr/lib/python2.7/dist-packages/__init__.py to *not* get symlinked to /usr/shared/pyshared/quickly/__init__.py

Removing the old python-quickly-common, then dpkg -i the oneiric debs *does* create the __init__.py, as of course does apt-get install --reinstall. It's the missing __init__.py symlink that causes 'import quickly' to fail.

So the question is whether python-central, dh_python2, or something else is to blame, and whether this is a systematic defect or just affects quickly. Or maybe it just affects pycentral->dhpy2 upgrades.

Still investigating.

Revision history for this message
Barry Warsaw (barry) wrote :

With help from Jakub Wilk and Julien Cristau, we've figured out the problem and come up with a solution.

quickly, prior to 11.09-0ubuntu1 used python-central. After that it switched to dh_python2. In addition, the Python files under dist-packages/quickly were split into python-quickly-common and python-quickly-core packages. (Aside: the changelog file describes why this was done, but not why. It might be good to know since this is the crux of the problem!)

dist-packages/quickly/__init__.py is provided by the -common package, and the -core package depends on it. However, the old -core's prerm actually *deletes* this __init__.py file. So here's what happens on an upgrade:

* -common gets upgraded before -core so if you just upgrade -common, the __init__.py is retained just fine
* old -core's prerm removes the __init__.py
* new -core does not contain the __init__.py, and since -common is already upgraded, you lose the __init__.py file!

My first thought was to add a postinst to -core to add the __init__.py symlink back if it was missing, but Jakub came up with a better solution not requiring maintainer scripts. First, add a Conflicts on python-quickly-common for python-quickly-core (<< 11.09). Second, add a versioned dependency on python-quickly-common (= ${source:Version}) for python-quickly-core.

Now, if you install the resulting packages with dpkg, it will break, but apt can actually resolve a solution that DTRT. By adding the conflict, we're ensuring that on an upgrade, -core is removed before anything else. This will delete the __init__.py file, but now it's okay because that will happen before new -common is installed, providing the __init__.py symlink.

I've verified that this works in a chroot. I'll upload a fix for release team approval.

Revision history for this message
Barry Warsaw (barry) wrote : Re: [Bug 850744] Re: quickly crashed with ImportError in __main__: No module named quickly

On Sep 30, 2011, at 10:25 PM, Barry Warsaw wrote:

>(Aside: the changelog file describes why this was done, but not why. It
>might be good to know since this is the crux of the problem!)

Er, *when* it was done, not why.

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

This bug was fixed in the package quickly - 11.10-0ubuntu2

---------------
quickly (11.10-0ubuntu2) oneiric; urgency=low

  * debian/control
    - python-quickly-common must conflict with older -core package so that
      the latter is removed before the newer -common is installed.
      Otherwise, the __init__.py file gets removed on distro upgrades,
      breaking package imports. The conflict forces apt to remove the old
      -core before adding the new -common, providing the __init__.py back
      again. Suggested by Jakub Wilk. (LP: #850744)
    - Update Standards-Version.
 -- Barry Warsaw <email address hidden> Fri, 30 Sep 2011 18:25:09 -0400

Changed in quickly (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
count.negative (count-negative) wrote :

fix confirmed after update to quickly 11.10-0ubuntu2

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.