1

After I followed this procedure, I have problems with

ImportError: No module named requests

When I

root@ubuntu:~# python -V
Python 2.7.8

And when I

root@ubuntu:~# pip install requests
Requirement already satisfied (use --upgrade to upgrade): requests in /usr/local/lib/python2.6/dist-packages
Cleaning up...

So it seems that I have requests installed but for python 2.6

EDIT, my system is Ubuntu 10.4 and previously I've installed requests via pip

I have:

root@ubuntu:~# which python
/usr/local/bin/python
root@ubuntu:~# which easy_install
/usr/bin/easy_install
Community
  • 1
  • 1
Marian Paździoch
  • 8,813
  • 10
  • 58
  • 103

1 Answers1

0

The problem is that the pip command you are using is "linked" to python2.6 version and not the one you want to use. You can try some things:

First of all check if you have any of pip2.7, pip-2.7 or easy_install-2.7 installed. If so you can use them to install your package:

pip-2.7 install requests # or easy_install-2.7 requests

If you don't have any of them try to run pip using your python version:

python /usr/local/bin/pip install requests

If this fails then I think the only way is to install pip manually. Before you do so, backup your system (usually python is used in many desktop and even cli apps in Ubuntu, so if you break it you may get a lot of problems).

  • First install setuptools: this will make available easy_install

    wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python
    
  • After this, you can install the package you need or if you will need pip in the future, install pip and use it from here

    easy_install pip
    pip install requests
    
Salem
  • 12,808
  • 4
  • 34
  • 54