Installing Python packages from a GitHub repo with Pipenv
April 16, 2021 ‐ 2 min read
Besides installing packages from PyPI you can directly install packages from, for example, GitHub. This feature is not exclusive to Pipenv, pip can do the same just as well.
For side-projects I use (mostly) just by myself I feel pretty save running on the development branch of the Django web framework. To install Django its development branch, called
main for Django, you need the location of the git repository.
Besides Git Pipenv should work with the version control systems Bazaar, Subversion and Mercurial as well.
The location of the Django git repository is
https://github.com/django/django.git for HTTP and
firstname.lastname@example.org:django/django.git for SSH. The
pipenv install command expects the following format:
<vcs_type>+<scheme>://<repository>@<branch_or_tag>#egg=<package_name. Pipenv recommends you to add the
-e option to the install command to install as an editable dependency.
Following the above format the Django install command will look like:
$ pipenv install -e git+https://github.com/django/django.git@main#egg=Django
Installing Django using SSH looks like:
$ pipenv install -e git+ssh://email@example.com/django/django.git@main#egg=Django
If you don't specify the
egg the installation fails with the warning: "pipenv requires an #egg fragment for version controlled dependencies."
For more information on this topic you can read the docs :-).