This article will share with you how to install requests in Python. The requests package in Python is used to make HTTP requests. It is very useful for programmers when working with web API. To set up the requests module, you can use the pip. See details below.
Install Requests In Python
The quests module in Python is used to make HTTP requests. This module abstracts the complexity of making requests behind a simple API, and it is one of the modules which is widely used in Python. To install requests in Python, you can use the pip.
Install the requests module in Python version 2
You can follow the following command in order to set up the request package in Python version 2.
pip install requests
If you get some Errors when setting up with the above command, you may not assign the pip in your environment. You can reinstall the requests module by running the following command.
python -m pip install requests
Install the requests module in Python version 3
You can follow the following command in order to set up the request package in Python 3 or newer.
pip3 install requests
If you get some Errors when setting up with the above command, you may not assign the pip in your environment. You can reinstall the requests module by running the following command.
python3 -m pip install requests
Install the requests module in Python without permissions
If you encounter an Error “Could not install packages due to an OSError: [WinError 2] The system cannot find the file specified” when installing the requests module. Run the following command to reinstall it.
pip install requests --user
Install the requests module on Anaconda
You can follow the following command in order to set up the request package on Anaconda.
python3 -m pip install requests
Install the requests module on Jupyter Notebook or Google Colaboratory
You can follow the following command in order to set up the request package on Jupyter Notebook or Google Colaboratory
!pip install requests
Check the requests module version
You can check the requests module version after setting up the requests module successfully with the __version__ attribute of the requests module.
Look at the example below.
import requests # Check the requests module version. print('Version: ' + str(requests.__version__))
Output
Version: 2.28.1
Summary
We have shared with you how to install requests in Python. You can do that by installing the requests module with the pip. However, you have to choose the solution that is the best for your current environment. We hope this tutorial is helpful to you. Thanks!

My name is Thomas Valen. As a software developer, I am well-versed in programming languages. Don’t worry if you’re having trouble with the C, C++, Java, Python, JavaScript, or R programming languages. I’m here to assist you!
Name of the university: PTIT
Major: IT
Programming Languages: C, C++, Java, Python, JavaScript, R