Friday, 23 January 2015

Python package installation error - pkg_resources.DistributionNotFound:xxx(package name)

If you encounter an error - "pkg_resources.DistributionNotFound:xxx(package name)" during python package installation, kindly check your setup tools version and it will most probably "setuptools 0.6rc11" or similar.

Recently, during installation of celery and flower - "a distributed task queue" packages, I encountered this error:

psj@psj-desktop:~/Downloads/nsrl-master/celery_client$ flower -h
Traceback (most recent call last):
  File "/usr/local/bin/flower", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 2655, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 648, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 546, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: celery


To get rid of this error, you have to upgrade existing global setuptools to the latest using:

psj@psj-desktop:~/Downloads/nsrl-master/celery_client$ sudo pip install -U distribute


If this does not work, the other option is to upgrade it to the latest version of setup tools using pypi repository.

Install latest setup tools from pypi repository
# wget https://bootstrap.pypa.io/ez_setup.py -O - | python

If this also does not work, then install latest version of setuptools using:

$ wget https://bitbucket.org/pypa/setuptools/raw/0.8/ez_setup.py
$ sudo /usr/bin/python ez_setup.py

After  this, my python package installation were successful:

#pip install celery
#pip install flower

Very nice and detailed explanations are given in Reinout's blog -





No comments:

Post a Comment