Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm receiving the following error when I run the command "easy_install imapclient":

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package distribute
root@localhost:/var/www/somedir# easy_install imapclient
install_dir /usr/local/lib/python2.6/dist-packages/
Searching for imapclient
Reading http://pypi.python.org/simple/imapclient/
Reading http://freshfoo.com/wiki/CodeIndex
Reading http://imapclient.freshfoo.com/
Best match: IMAPClient 0.8.1
Downloading http://freshfoo.com/projects/IMAPClient/IMAPClient-0.8.1.zip
Processing IMAPClient-0.8.1.zip
Running IMAPClient-0.8.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-BmlBbm/IMAPClient-0.8.1/egg-dist-tmp-5OVaNN
The required version of distribute (>=0.6.24) is not available,
and can't be installed while this script is running. Please
install a more recent version first, using
'easy_install -U distribute'.

(Currently using distribute 0.6.14 (/usr/lib/python2.6/dist-packages))
error: Setup script exited with 2

Any thoughts on what might be causing this?

I've tried running "easy_install -U distribute" as suggested in the above output, which returns the following output:

install_dir /usr/local/lib/python2.6/dist-packages/
Searching for distribute
Reading http://pypi.python.org/simple/distribute/
Reading http://packages.python.org/distribute
Best match: distribute 0.6.24
Processing distribute-0.6.24-py2.6.egg
distribute 0.6.24 is already the active version in easy-install.pth
Installing easy_install script to /usr/local/bin
Installing easy_install-2.6 script to /usr/local/bin

Using /usr/local/lib/python2.6/dist-packages/distribute-0.6.24-py2.6.egg
Processing dependencies for distribute
Finished processing dependencies for distribute

I'm running Ubuntu 10.04 64-bit Server if that helps any.

share|improve this question
    
+1 for both of you! thanks so much for taking the time to figure this out and sharing the knowledge! X-Cubed gets the "correct answer" rewarded to him for a clear cut and precise example. –  Joshua Burns Jul 16 '12 at 21:45
add comment

2 Answers 2

up vote 2 down vote accepted

I'm sure this isn't the right way to do it, but it worked for me. I modified /usr/bin/easy_install script and removed the version constraint for distribute, so it now looks like this:

#! /usr/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'distribute','console_scripts','easy_install'
__requires__ = 'distribute'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('distribute', 'console_scripts', 'easy_install')()
    )
share|improve this answer
    
It should be noted that this edit allows you to successfully run "easy_install -U distribute", which in turn allows you to then run "easy_install imapclient". –  Joshua Burns Jul 16 '12 at 21:47
add comment

I had the same problem on the same version of Ubuntu (but 32-bit instead of 64).

The problem is that our old version of pip and easy_install is trying to install newer python modules that require newer versions of distribute than our version of pip/easy_install likes. And like X-Cubed pointed out, easy_install (hence pip) requires a specific, old version of distribute. X-Cubed's solution worked for me, but instead of eliminating the version I set it to a minimum, so that other easy_installs (and pips) can require lower versions, if necessary. So the /usr/bin/easy_install lines that changed are:

__requires__ = 'distribute>0.6.10'

and

load_entry_point('distribute>0.6.10', 'console_scripts', 'easy_install')()

Presumably distribute plays nice and is always reverse compatible. If so this will cause fewer problems than easy_install requiring a specific version of distribute that doesn't work for many python modules.

Then I reran pip for my requirements (pip install requirements/*) which needed the URLObject python module, and it got through the version conflict issue just fine after I made this change. (so X-Cubed was at least partially right and probably 100% right).

This sed will also fix it

sudo sed -i -r -e 's/distribute==/distribute>/g' /usr/bin/easy_install
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.