Member-only story
How to Install Python Packages from GitHub Using pip
When working with Python, you might encounter situations where a package you need isn’t available on PyPI (Python Package Index) but is hosted on GitHub instead. Whether it’s a cutting-edge feature, a custom implementation, or a forked version of an existing library, you can easily install it using pip
. Here's a complete guide to installing Python packages directly from GitHub.
Read for free: https://allwin-raju.medium.com/how-to-install-python-packages-from-github-using-pip-54dd6a2f7f0f?sk=394ebba93e94a0e6970dbf3e8854e4b1
1. Basic Installation
To install a Python package from a public GitHub repository, use the following command:
pip install git+https://github.com/<username>/<repository>.git
- Replace
<username>
with the GitHub username. - Replace
<repository>
with the name of the repository.
For example:
pip install git+https://github.com/pallets/flask.git
2. Installing a Specific Branch
If the package resides in a branch other than the default (main
or master
), specify the branch name in the command:
pip install…