Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip install broken (pkg_resources.find_distribution returns empty list in req.py-prepare_files)

At some point my pip installation broke (I suspect when upgrading to Ubuntu 14.04) and I haven't been able to unbreak it by completely removing it and reinstalling (via synaptic package manager). It doesn't occur for all packages but for a few common ones such as autopep8 and even setuptools itself.

The error I am getting is

Downloading from URL https://pypi.python.org/packages/3.3/p/pep8/pep8-1.5.6-py2.py3-none-any.whl#md5=c7da9fb6a4316b53b6a873de076441e2 (from https://pypi.python.org/simple/pep8/)
Cleaning up...
  Removing temporary dir /tmp/pip_build_tclose...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1259, in prepare_files
    )[0]
IndexError: list index out of range

which occurs when pkg_resources.find_distribution(<what-appears-to-be-a-temp-build-directory-for-package-to-install>) returns an empty list. I am kind of out of ideas so any pointers would be most appreciated.

like image 534
Tom Close Avatar asked May 28 '14 01:05

Tom Close


1 Answers

Had the same problem and the apt-get remove solution didn't work for me. Updating pip without wheel worked for me:

sudo pip install -U --no-use-wheel pip
like image 152
Hensing Avatar answered Sep 28 '22 16:09

Hensing