Importerror: no module named requests error comes into the picture when the requests module not available or uninstalled. In this article, We will see various ways to install the requests python package.
Importerror: no module named requests ( Solution ) –
Let’s see the various ways to install the requests module for fixing the bug no module named requests.
1.Use pip for requests module-
The easiest and popular way to install the requests package is a pip. Let’s directly jump into the command section. Use the below command.
pip install requests
If you are specifically using a python 3 interpreter and you want to install the requests package. You may use the alternative command.
pip3 install requests
In case you have already installed the pip manager but the path is not proper. You may use the below command.
python -m pip install requests
Of course like we have specifically done python3 in the place of python. The same rules apply here.
python3 -m pip install requests
2. Use easy install for requests module-
Like pip package manager, we may use an easy install package. Here is the command for this.
sudo easy_install -U requests
3. Use System package manager ( Linux family OS only) –
This will only work with linux family OS like centos and Ubuntu. You may use yum or apt-get package manager. Here is the command for them.
apt-get install python-requests
Lets try the yum also.
yum install python-requests
Request package is useful in invoking the rest of APIs and sending HTTP/1.1 requests. It has so many configurations which make the Sessions with Cookie Persistence extremely easy. It also supports Browser-style TLS/SSL Verification seamless. You may also parameterize the Connection Timeouts with the requests package.
The python module requests are one of the most common and useful modules for every python developer. I hope this article must help you in resolving the bug ( importerror: no module named requests ).
Data Science Learner Team
Join our list
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.