UserWarning printed on import pkg_resources'

Bug #810019 reported by Scott Moser
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
distribute (Debian)
Fix Released
Unknown
distribute (Ubuntu)
Invalid
Medium
Unassigned
Oneiric
Invalid
Medium
Unassigned
paste (Ubuntu)
Fix Released
Medium
Dave Walker
Oneiric
Fix Released
Medium
Dave Walker

Bug Description

$ python -c 'import pkg_resources'
<smoser> -c:1: UserWarning: Module paste was already imported from None, but /usr/lib/python2.7/dist-packages is being added to sys.path

$ dpkg-query --show python-pkg-resources
python-pkg-resources 0.6.16-1

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: python-pkg-resources 0.6.16-1
ProcVersionSignature: User Name 3.0-3.4-virtual 3.0.0-rc5
Uname: Linux 3.0-3-virtual x86_64
Architecture: amd64
Date: Wed Jul 13 17:15:31 2011
PackageArchitecture: all
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: distribute
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
Scott Moser (smoser) wrote :
Revision history for this message
Scott Moser (smoser) wrote :

since the last update of 'distribute' was some 8 weeks ago, this is not filed correctly, but i'm not sure what the correct source is.

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

This only happens after `apt-get install python-paste` so that's where the problem must be. Having trouble moving it to that project though.

Scott Moser (smoser)
affects: distribute (Ubuntu) → paste (Ubuntu)
Changed in paste (Ubuntu):
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Scott Moser (smoser) wrote :

The debian bug seems to think that this is related to 'distribute', and has info on it occuring also with 'import MySQLdb'

affects: paste (Ubuntu) → distribute (Ubuntu)
Changed in distribute (Debian):
status: Unknown → New
Scott Moser (smoser)
tags: added: server-o-rs
Dave Walker (davewalker)
Changed in distribute (Ubuntu):
milestone: none → ubuntu-11.10-beta-2
Revision history for this message
Gediminas Paulauskas (menesis) wrote :

This happens with paste because it is not installed correctly. namespace_packages.txt and Paste-*.pth are removed after install, and this confuses dh_python2 and python import machinery.

Leaving those files in place eliminates the cause for the warning.

Revision history for this message
Scott Kitterman (kitterman) wrote :

paste is converted to dh_python2 in Debian. Updating that might help.

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

Piotr, do you have an opinion on this?

Revision history for this message
Iain Lane (laney) wrote :

The find line which attempts to remove *.pth doesn't do so. You need to add parentheses around it like so

  find $(PKGDIR) \( -name '*.pth' -or -name 'namespace_packages.txt' \) -delete

Revision history for this message
Julian Taylor (jtaylor) wrote :

the issue also occurs with python-argparse installed:

$ mkdir -p external/argparse
$ touch external/__init__.py
$ echo "import argparse" > external/argparse/__init__.py
$ python -c "import external.argparse; import pkg_resources"
-c:1: UserWarning: Module argparse was already imported from /usr/lib/python2.7/argparse.pyc, but /usr/lib/python2.7/dist-packages is being added to sys.path

Revision history for this message
Iain Lane (laney) wrote :

Removing the .pth breaks paste (thanks Daviey):

(sid-amd64)root@raleigh:/srv/home/laney# python -c 'import paste'
(sid-amd64)root@raleigh:/srv/home/laney# rm /usr/lib/python2.6/dist-packages/Paste-1.7.5.1-nspkg.pth
(sid-amd64)root@raleigh:/srv/home/laney# python -c 'import paste'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named paste

Revision history for this message
Piotr Ożarowski (piotr) wrote :

as Iian pointed out, my last upload broke the find call and that's why you're getting this warning.

Ian: removing .pth file is the right fix, if it doesn't work for you, something else is wrong on your system. Are you sure you didn't remove paste directory as well?

Revision history for this message
Piotr Ożarowski (piotr) wrote :

heh, __init__.py file is missing as well

Revision history for this message
Iain Lane (laney) wrote :

debdiff for re-merge.

Piotr, do you want to take this fix in Debian too? Move -mochikit to suggests since the reason for moving it up to recommends doesn't apply any more.

Changed in distribute (Ubuntu Oneiric):
status: Confirmed → Opinion
status: Opinion → Invalid
Changed in paste (Ubuntu Oneiric):
status: New → Confirmed
importance: Undecided → Medium
milestone: none → ubuntu-11.10
Revision history for this message
Scott Kitterman (kitterman) wrote : Re: [Bug 810019] Re: UserWarning printed on import pkg_resources'

A fixed paste (and the other two paste packages too) was already uploaded to
Debian.

Revision history for this message
Dave Walker (davewalker) wrote :

Merge form sid currently in unapproved queue.

Changed in paste (Ubuntu Oneiric):
status: Confirmed → Fix Committed
assignee: nobody → Dave Walker (davewalker)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package paste - 1.7.5.1-4ubuntu1

---------------
paste (1.7.5.1-4ubuntu1) oneiric; urgency=low

  * Merge from debian unstable (LP: #810019). Remaining changes:
    - debian/control: Demote libjs-mochikit back to suggests because dh_python2
      doesn't have the same symlink problem as python-support.

paste (1.7.5.1-4) unstable; urgency=low

  * Add also missing __init__.py file

paste (1.7.5.1-3) unstable; urgency=low

  * Remove .pth file (introduced in last upload by accident)
  * Add build-indep and build-arch targets in debian/rules
  * Let dh_sphinxdoc handle documentation files, python-sphinx build
    dependency bumped to 1.0.7+dfsg-1
 -- Dave Walker (Daviey) <email address hidden> Mon, 26 Sep 2011 18:45:19 +0000

Changed in paste (Ubuntu Oneiric):
status: Fix Committed → Fix Released
Revision history for this message
Iain Lane (laney) wrote :

What was wrong with my diff?

Revision history for this message
Dave Walker (davewalker) wrote :

Apologies Laney, I thought yours was not based on a merge. I should have looked closer. Sorry.

Revision history for this message
Iain Lane (laney) wrote :

On Tue, Sep 27, 2011 at 11:37:09AM -0000, Dave Walker wrote:
> Apologies Laney, I thought yours was not based on a merge. I should
> have looked closer. Sorry.

No worries, was just wondering if I messed something up :-)

tags: added: rls-mgr-o-tracking
Changed in distribute (Debian):
status: New → Fix Released
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.