ImportError: No module named requests

Python requests module

Requests is a HTTP library and it allows you to send HTTP requests using Python programming language. This module abstracts the complexities of making requests behind an intelligent API so that you can focus on interacting with services and consuming data in your application. When one makes a request to a URI, it returns a response. Python requests module provides inbuilt functionalities for managing both the request and response.

ImportError: No module named requests

In Python, if you try to import Requests without installing the module using pip, you will get ImportError: no module named requests error. The most likely reason is that Python doesn't provide requests in its standard library. This means that requests module is not a built in module and it does not come with the default python installation. So, you need to install requests module using Python's package manager "pip".

Install requests module in Python


No module named requests python

Windows

The easiest and popular way to install the requests package is using a pip command. If you have pip installed and Pip.exe added to the Path Environment Variable:

pip install requests

for Python 3:

pip3 install requests

The error might persist even after you have installed the requests library. This likely happens because pip is installed but doesn't reside in the path you can use. The following command can be run even when pip path is not set.

py -m pip install requests

OSX/Linux

sudo pip install requests

for Python 3:

sudo pip3 install requests

Debian/Ubuntu

sudo apt-get install python-requests

for Python 3:

sudo apt-get install python3-requests