Search code examples
pythonpython-2.7python-3.xpackagepip

ImportError: No module named pip when trying to install packages


Have a fresh install of Ubuntu 13.10 with PyCharm and when setting up the python interpreter I selected 'install setuptools', then 'install pip'. Now if I try and do anything with pip I get the following:

  ciaran@ciaran-desktop:~/pycharm/bin$ pip
  Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 357, in load_entry_point
   """Does the package's distribution contain the named metadata?"""
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2394, in load_entry_point

  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2108, in load

  ImportError: No module named pip

I have tried on python 2.7.5 and 3.3.2 and both yield the same results.

Edit: The above output is from the terminal. PyCharm outputs the following:

Error: Python package management tool 'pip' not found 

Solution

  • I found that on Ubuntu, pip will not always set read and execute permissions for the modules it installs. My solution is to always run this shell script:

    sudo chmod -R a+rX /usr/lib/python*/dist-packages/
    sudo chmod -R a+rX /usr/local/lib/python*/dist-packages/
    sudo chmod a+rX /usr/bin/*
    sudo chmod a+rX /usr/local/bin/*