Community Packages

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#47243 - [python2-google-api-python-client] python2-setuptools upgrade 1:18.7-1 -> 1:18.7.1-1 breaks ipython2

Attached to Project: Community Packages
Opened by Janna Martl (jmartl109) - Thursday, 03 December 2015, 02:12 GMT
Last edited by Andrzej Giniewicz (Giniu) - Thursday, 03 December 2015, 19:16 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Andrzej Giniewicz (Giniu)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description: Upgrading python2-setuptools from 1:18.7-1 -> 1:18.7.1-1 makes me unable to start ipython2. I get the following traceback:

Traceback (most recent call last):
File "/usr/bin/ipython2", line 4, in <module>
from IPython import start_ipython
File "/usr/lib/python2.7/site-packages/IPython/__init__.py", line 48, in <module>
from .terminal.embed import embed
File "/usr/lib/python2.7/site-packages/IPython/terminal/embed.py", line 16, in <modul
from IPython.core.interactiveshell import DummyMod
File "/usr/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 31, in
from pickleshare import PickleShareDB
File "/usr/lib/python2.7/site-packages/pickleshare.py", line 41, in <module>
from path import path as Path
File "/usr/lib/python2.7/site-packages/path.py", line 126, in <module>
except pkg_resources.DistributionNotFound:
NameError: name 'pkg_resources' is not defined

This happens when I move my ~/.ipython directory out of the way, and when I start ipython2 with a newly made user, so I don't think it's something wrong with my configuration, but on the other hand it works when I run ipython2 as root. Maybe a permissions issue in the packaging?

Additional info:
* package version(s): 1:18.7-1 -> 1:18.7.1-1
* config and/or log files etc.: see above


Steps to reproduce:
Run ipython2 with a non-root user.
This task depends upon

Closed by  Andrzej Giniewicz (Giniu)
Thursday, 03 December 2015, 19:16 GMT
Reason for closing:  Fixed
Additional comments about closing:  Added workaround in 1.4.2-2 (just simple chmod). This must be some bigger change, because I also hit it with python2-blist. Reported to AUR.

If you experience any more issues, feel free to reopen this. Thanks!
Comment by Doug Newgard (Scimmia) - Thursday, 03 December 2015, 04:13 GMT
If you just run `python2` and a command line and do `import path`, does anything happen?
Comment by Janna Martl (jmartl109) - Thursday, 03 December 2015, 04:21 GMT
I get:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/path.py", line 126, in <module>
except pkg_resources.DistributionNotFound:
NameError: name 'pkg_resources' is not defined

(this works correctly as root).
Comment by Doug Newgard (Scimmia) - Thursday, 03 December 2015, 04:26 GMT
So ipython doesn't have anything to do with it, it's python2-path.

For the record, the above works fine for me, so I don't think there's a problem with the package. Try reinstalling it, see if pacman mentions anything.

Edit: You said it works correctly as root, I'd bet it works correctly as another non-root user as well. Most likely a configuration issue.
Comment by Janna Martl (jmartl109) - Thursday, 03 December 2015, 08:49 GMT
As mentioned, I created an entirely new user and the problem persisted when logged in as that user. Also, I ran ipython2 with strace under the new user, and found no mention of /home/ (other than /home/user/.local/lib/python2.7/site-packages, which didn't exist for me or for root). I did have some non-pacman-owned stuff in /usr/lib/python2.7/site-packages/, but I moved out almost everything and the problem didn't go away. If it's a configuration issue, I'm not sure what else to check for.

I reinstalled python2-setuptools, python2-path, and python2-pathlib; I didn't see any error messages, and that didn't solve the problem either.

However, when I replace the contents of /usr/lib/python2.7/site-packages/pkg_resources/ with the version in the old package, it works again. Permissions on this directory and its contents look normal.
Comment by Doug Newgard (Scimmia) - Thursday, 03 December 2015, 16:13 GMT
Running `python2` again, try `import pkg_resources`. Successful?
Comment by Janna Martl (jmartl109) - Thursday, 03 December 2015, 16:39 GMT
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3138, in <module>
@_call_aside
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3124, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3151, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 652, in _build_master
ws = cls()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 645, in __init__
self.add_entry(entry)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 701, in add_entry
for dist in find_distributions(entry, True):
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2139, in find_on_path
path_item, entry, metadata, precedence=DEVELOP_DIST
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2521, in from_location
py_version=py_version, platform=platform, **kw
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2835, in _reload_version
md_version = _version_from_file(self._get_metadata(self.PKG_INFO))
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2486, in _version_from_file
line = next(iter(version_lines), '')
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2654, in _get_metadata
for line in self.get_metadata_lines(name):
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1643, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1635, in get_metadata
return self._get(self._fn(self.egg_info, name))
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1746, in _get
with open(path, 'rb') as stream:
IOError: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/google_api_python_client-1.4.2-py2.7.egg-info/PKG-INFO'

Aha! Indeed,

$ ls -l /usr/lib/python2.7/site-packages/google_api_python_client-1.4.2-py2.7.egg-info
total 20
-rw-r----- 1 root root 1 Sep 20 03:22 dependency_links.txt
-rw-r----- 1 root root 969 Sep 20 03:22 PKG-INFO
-rw-r----- 1 root root 62 Sep 20 03:22 requires.txt
-rw-r----- 1 root root 739 Sep 20 03:22 SOURCES.txt
-rw-r----- 1 root root 58 Sep 20 03:22 top_level.txt

That file is owned by python2-google-api-python-client. Removing (I'm sure it's really gone) and reinstalling that package doesn't change anything, but if I do

$ sudo chmod -R 0644 /usr/lib/python2.7/site-packages/google_api_python_client-1.4.2-py2.7.egg-info

then everything works again. So it looks like package permissions on python2-google-api-python-client are incorrect?

Loading...