How to Fix ImportError: No module named requests

Python comes with a standard set of modules that can be used by the users directly by importing them into the program. If you want to use the external modules, they are available in the PyPI repository.

To use an external module from the PyPI repository, we have to first install that moudle on our system. To install the module on your system, we can make use of the package managing tools like pip, easy-install, etc.

The Import Error: No module named requests signifies that Python is not able to find the module named requests. This can happen in the following cases:

  • We try to import the module without installing it.
  • We have installed the module in the global space and we’re trying to access it from a virtual environment or vice-versa.
  • When there are various versions of Python in the system, the module may be installed on a recent version. If you’re trying to import the module in the previous versions, this error is seen.

Now, that we’ve identified various cases, let’s figure out how to fix this issue in various cases.

Is the package installed on your system? 

The package doesn’t appear magically. You have to install it. To install the package on your system do the following:

1. Open your Command Prompt window.

2. Enter the below command and press Enter.

If you have pip.exe added to your PATH, use the below command:

pip install requests

If pip is not added to the PATH, use this command: 

python -m pip install requests


Import Error: no module named requestspip install requests



Note: If you’re using Python 3+ use one of the below commands appropriately.

pip3 install requests


python3 -m pip install requests


3. In your program import the requests module using the below statement and run the program

import requests

Do you see the error? If yes, then read along.


Are you using the module from a Global Space or a Virtual Environment? 

If you’ve installed the module from Command Prompt, it will be installed on a global space. 

Note that if you’re using IDEs, you have a virtual environment configured for each project. By default, the modules installed in global space are not accessible within the virtual environment. That’s why you’re seeing an error.

In this case, Open the IDE and do the following:

Note: We are using PyCharm for demonstration purposes. Options in other IDEs should be similar.

1. Click on the Terminal tab as shown below.

2. Now install the package in this location using the below command:

pip install requests



Note: You can also do this from the command prompt, you have to navigate to the location of your virtual environment and then install the module. We are doing this from IDE’s Terminal as it opens the Virtual environment’s location by default.

Now, try importing the module into your program.


Do you have various versions of Python installed on your system? 

Let’s say you have installed python versions 3.4 and 3.10 on your system. Now, you want to run your program using Python 3.4.

By default, when you open the command prompt and try installing the module, it will be installed in the Python version 3.10’s site-package folder. Thus, when you run your program using Python3.4, you see an error.

To fix this, go to the appropriate location where Python 3.4 is installed.

1. Right-click and choose Open in Windows Terminal.


Open Windows Terminal in appropriate Python version folder


2. Now, install the module using the below command:

pip install requests


pip install requests in proper version path


3. Import the module in your program. Run your program and check if it works.



This brings us to the end of this article. We hope this article has been informative. Kindly comment and let us know the fix that helped you. Also, let us know if you’re facing any issues. We will be glad to help.

Thanks for reading.


If you enjoyed reading, share this article.

Anusha Pai is a Software Engineer having a long experience in the IT industry and having a passion to write. She has a keen interest in writing Python Errorfixes, Solutions, and Tutorials.

Leave a Comment