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.
asked Jul 4, 2017 at 20:55
Jaskunwar singhJaskunwar singh
2052 gold badges5 silver badges10 bronze badges
13
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:UsersmyLocalUserNameAppDataLocalProgramsPythonPython36Scripts
pip install requests
answered Oct 12, 2017 at 10:01
In PyCharm you should:
- Go back to base configuration in «File» — «Settings» — «Python Interpreteter» (it is the path that ends with «…python.exe»)
- Click on the plus and install this module by typing name in search field.
- Choose this configuration and run it by pressing Ctrl+Alt+F10
Tonechas
13.3k15 gold badges45 silver badges80 bronze badges
answered May 9, 2021 at 17:55
For listing instaled modules for Python 3:
sudo pip3 list
For installing the request
module for Python 3:
sudo pip3 install requests
answered Jul 19, 2021 at 12:27
simhumilecosimhumileco
31.2k16 gold badges137 silver badges112 bronze badges
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:pythonScripts> 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
answered Jun 30, 2021 at 4:54
Activate Virtual Environment
.envScriptsactivate
Install the dependencies,
pip install request
answered Aug 8, 2021 at 5:32
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>AppDataLocalProgramsPythonPython36Scripts
pip install requests
nathan liang
9502 gold badges11 silver badges22 bronze badges
answered Jul 10, 2022 at 17:15
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.
answered Jul 17, 2022 at 23:43
when i run server i have below error:
ModuleNotFoundError: No module named 'requests'
but requests have been installed on my system, when i run sudo pip3 install requests
command, output is :
Requirement already satisfied: requests in /home/sadegh-khan/.local/lib/python3.6/site-packages
the terminal pic of my error and command to install requests is:
asked Apr 14, 2018 at 15:43
6
You’re installing requests by running pip as sudo, which means it is installed globally. Yet your screenshot (and please don’t post screenshots anyway) shows you are inside a virtualenv, .venv
.
Don’t use sudo
; just install requests inside the venv.
answered Apr 14, 2018 at 15:50
Daniel RosemanDaniel Roseman
586k63 gold badges873 silver badges888 bronze badges
2
If you are using Python3 instead of running the server using python manage.py runserver go ahead and run python3 manage.py runserver
Instead of
python manage.py runserver
or
py manage.py runserver
Run
python3 manage.py runserver
answered Sep 12, 2020 at 17:37
crispengaricrispengari
7,4735 gold badges42 silver badges51 bronze badges
Errors are an inevitable part of programming, and every programmer will encounter them at some point in their career.
Errors in programming can take various forms, including syntax errors, logic errors, and runtime errors, and they can have a significant impact on the functioning of a program.
Understanding the different types of errors in programming and learning how to identify and fix them is essential for writing robust and reliable code.
In this regard, various tools, such as debuggers, profilers, and automated testing frameworks can help you detect and fix errors more efficiently.
In this quick tutorial, we’ll look at a specific Python error – the «ModuleNotFoundError: no module named 'requests'
» error – to see what causes it and how to fix it.
The ModuleNotFoundError: no module named 'requests'
error occurs when you try to import the requests
module in your Python code but the module is not installed or not available in the current environment.
This error is commonly encountered when using Python Django because the requests
module is often used for making HTTP requests in Django applications.
How to Fix the ModuleNotFoundError: no module named 'requests'
Error in Python
To solve this error, you can follow these steps:
First, check if the requests
module is installed. Open a terminal or command prompt and enter the following command:
pip freeze | grep requests
This command will search for the requests
module in your environment and print its version number if it is installed. If nothing is printed, it means that the module is not installed.
If the requests
module is not installed, you can install it by running the following command in your terminal or command prompt:
pip install requests
This command will download and install the requests
module and all its dependencies.
Then you’ll need to check if the requests
module was imported correctly. Once the requests
module is installed, you can import it in your Python code using the following statement:
import requests
Make sure that this statement is placed at the top of your Python file before any other statements that use the requests
module.
Finally, if you are using the requests
module in a Python Django application, you may need to restart your server after installing the module to ensure that the changes take effect.
Wrapping Up
By following these steps, you should be able to solve the ModuleNotFoundError: no module named 'requests'
error and use the requests
module in your Python Django application.
And that is it!
Feel free to connect with me on Twitter and on LinkedIn. You can also subscribe to my YouTube channel.