ModuleNotFoundError: No module named 'requests'

Viewed 38130

I have installed the pip3 as well as requests package in my pc.Even then on running the command import requests on my shell,i am getting the following error:

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

I have to manually copy all the packages to my working directory to tackle this exception.

7 Answers

Find were your python is installed and find Scripts directory. Open cmd, go to this folder and type pip install requests.

For me it was like below:

cd C:\Users\myLocalUserName\AppData\Local\Programs\Python\Python36\Scripts
pip install requests

In PyCharm you should:

  1. Go back to base configuration in "File" - "Settings" - "Python Interpreteter" (it is the path that ends with "...\python.exe")
  2. Click on the plus and install this module by typing name in search field.
  3. Choose this configuration and run it by pressing Ctrl+Alt+F10

For listing instaled modules for Python 3:

sudo pip3 list

For installing the request module for Python 3:

sudo pip3 install requests

Make sure that requestes module should have version starts with 2

Not correct

pip3 list

Package Version


requestes 0.0.1

I installed this and installed using

 python -m pip install requests

Later :

PS C:\python\Scripts> pip list

Package Version


certifi 2021.5.30

chardet 4.0.0

idna 2.10

pip 21.1.3

requests 2.25.1

urllib3 1.26.6

Activate Virtual Environment .\env\Scripts\activate Install the dependencies,

pip install request

Been tackling this issue for 2 hours now, this solution did it!

Find your Python installation location and, specifically, the Scripts directory. Open cmd, and run the following:

cd C:\Users\<myLocalUserName>\AppData\Local\Programs\Python\Python36\Scripts
pip install requests

For me, I used the package manager within my IDE (Pycharm in this case) to see if 'request' was installed. Once I did that, then the error went away. I also tried pip install, but I suspect I have multiple python on the system and pip didn't install to the correct python. This is why others are suggesting to install from a specific python installation.

In Linux or Mac, you can run 'which python' for additional clues.

Related