How to Install a Python Package .Whl File

This tutorial will teach you how to install a Python package distributed as a .whl file.

How to Install a Python Package .Whl File

A .whl file is a Python package saved in the Wheel format, a standard packaging format used for Python packages. Whl files are developed to facilitate the easy distribution of Python packages and modules, especially those with many complex dependencies.

A Wheel file is a ZIP-format archive with a specially formatted filename and the .whl extension. It includes all the files and metadata needed for the package and information about the package's dependencies and compatibility with different versions of Python. This makes it a convenient way of packaging and distributing Python modules.

Python Install whl File

To install a .whl file, you can use the pip command. The command syntax is as shown:

pip install package_name.whl

For example, the command below demonstrates how to install the beautifulsoup4 package from a whl file.

pip install beautifulsoup4-4.11.1-py3-none-any.whl

This should download all the required dependencies and set up the specified setup on your machine.

Python Upgrade Package From whl File

We can also use the -U flag to upgrade an existing package to a newer version using a .whl package. The command syntax is as shown:

pip install -U package_name.whl

An example command is as shown:

pip install -U beautifulsoup4-4.11.1-py3-none-any.whl


In this tutorial, you learned about the wheel packaging format, what it is and how it works. You also learned how to install and upgrade packages using .whl files.

If you enjoy our content, please consider buying us a coffee to support our work:

Table of Contents
Great! Next, complete checkout for full access to GeekBits.
Welcome back! You've successfully signed in.
You've successfully subscribed to GeekBits.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.