close

[Solved] ImportError: No module named requests

Hello Guys, How are you all? Hope You all Are Fine. I am using request in my code and when I run my code It gives me the following error: ImportError: No module named requests in Python. So Here I am Explain to you all the possible solutions here.

Without Wasting your time, Lets start This Article to Solve This Error.

How ImportError: No module named requests Error Occurs ?

I am using request in my code and when I run my code It gives me the following error:

File "ex2.py", line 1, in <module>
    import requests
ImportError: No module named requests

How To Solve ImportError: No module named requests Error ?

Question: How To Solve ImportError: No module named requests Error ?
Answer: To solve ImportError: No module named requests you just need to install requests in your machine. To install requests just use the below command. For Ubuntu, Python2 uses sudo apt-get install python-requests this command. For Windows Python3 use python3 -m pip install requests this command. For Ubuntu, Python3 uses sudo apt-get install python3-requests this command. For Windows Python2 use python -m pip install requests this command.

Solution 1

Error Says, they cant find the requests module so you have to install the requests module first then you can use requests. To install requests just use the below command.

For Ubuntu Python2

sudo apt-get install python-requests

For Windows Python3

python3 -m pip install requests

For Ubuntu Python3

sudo apt-get install python3-requests

For Windows Python2

python -m pip install requests

Solution 2

If you pip Path Not set Then use this command. Using using Python 3.7 running on Windows 10 and this is the command.

py -m pip install requests

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment