How to Resolve ImportError: No module named requests Error

In this post, we will explore various ways of fixing the ImportError: No module named requests when importing the requests library in Python.

How to Resolve ImportError: No module named requests Error

The requests library is one of the python ecosystem's most popular and valuable packages. It is a simple yet mighty HTTP library that allows you to quickly and easily interact with the HTTP protocol.


>>> import requests

Error Message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'requests'

Solution 1 - Install the Requests Library in Your Environment

Despite its popularity and usefulness, the requests library is not part of Python's standard library. This means you will need to install the library in your environment before importing it.

You can do so by running the pip command:

pip3 install requests


pip install requests

If you are using conda, run:

conda install -c anaconda requests

NOTE: The commands above assume you have pip or conda installed on your system and available in your system path.

Solution 2 - FIx System Path

Sometimes, you may get the no module named requests error even after installing the request module. You can resolve this by adding pip to your system path using the python module import:

python3 -m pip install requests


python -m pip install requests

Solution 3 - Install Requests Via Package Manager

If installing requests with the pip command does not work for you, you can try installing the requests module using your system's package manager:

sudo apt-get install python3-requests


sudo apt-get install python-requests


This article covers some basic techniques for resolving the 'no module named requests' error when importing the requests module in Python.

We hope you find this tutorial helpful. Leave us a comment below or contact us if you cannot resolve the issue.

If you enjoy our content, please consider buying us a coffee to support our work:

Table of Contents
Great! Next, complete checkout for full access to GeekBits.
Welcome back! You've successfully signed in.
You've successfully subscribed to GeekBits.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.