Windows: Install the Requests package using pip
Anaconda users
If you have installed Anaconda the requests package is included in the distribution. Anaconda utilizes Conda rather than pip as its package manager. See the companion guide "Updating the requests package (Anaconda users)".
1.0 About pip
pip is Python’s default package installer. pip
provides a
pain-free way of installing community-developed Python packages that extend the Python standard
library.
Since Python 3.4 pip
comes bundled with the release so you do not need to install it, although
you may need to upgrade it if the version installed on your machine is outdated.
2.0 Install the requests package
Follow the steps below to install the requests
package.
2.1 Open Bash terminal
Click the start menu icon (lower left corner). Type “Git” in the search
box. This should highlight the Git Bash
app. Click the highlighted app
selection or the “Open” or “run as administrator” links to start the shell.
2.2 Check Python version
Not strictly necessary, but always a good practice.
python --version
Python 3.10.2
2.3 Check pip version
Enter the following command:
python -m pip --version
pip 22.0.4 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)
💡 The -m
option instructs the Python interpreter to run the pip
module as a script.
⚠️ If you try to invoke pip
directly you are liable to encounter the following warning:
pip --version
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
pip 22.0.4 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)
2.4 Update pip
If running a version of pip
< 22.0.4 consider updating it:
python -m pip install -U pip
2.5 List installed packages
Check your currently installed packages. The example output below is a minimal listing of installed packages. You may encounter more packages, indeed, significantly more packages, if you installed Python 3.x using Anaconda or have installed Python packages previously.
python -m pip list
Package Version
---------- -------
pip 22.0.4
setuptools 60.10.0
wheel 0.37.1
If the requests package does not appear in the list of installed packages proceed to step 1.6.
❗ If the requests package is currently installed check if it is outdated. If it is outdated, consider updating the package.
python -m pip list --outdated
python -m pip install --upgrade requests
2.6 Install the requests package
Install the requests package.
❗ The package name is “requests” (plural) not “request”.
python -m pip install requests
Installing the requests package will also install a number of additional packages that the requests libraries relies on (i.e., dependencies). When complete the a “Successfully installed” line will be written to the screen.
Successfully installed . . . [installed package versions listed]
2.7 List installed packages (recheck)
Issue the pip list
command to return a list of the all installed packages. Confirm that the
requests package has been installed.
python -m pip list
Package Version
---------- ---------
...
requests 2.27.1
...
👍 Congratulations. Your package install work is done.
3.0 Other useful pip commands
3.1 Check for outdated packages
python -m pip list --outdated
Package Version Latest Type
---------- ------- ------ -----
requests 2.26.0 2.27.1 wheel
3.2 Upgrade a package
python -m pip install --upgrade requests
3.3 Delete a package
python -m pip uninstall requests