how do I specify in my pip requirements.txt to install from git repository

273 views Asked by At

pip is able to install directly from git.

Example:

pip install git+ssh://[email protected]:owner/repository_name.git

After developing a project in a virtual environment and installing all its dependencies, I construct the requirements.txt file using the shell command pip freeze > requirements.txt.

However, in the requirements.txt file, I get a package name and version number like this (random example):

Flask==0.10.1

This then breaks if I run

pip install -r requirements.txt

I would like to explicitly specify that the installation should happen from a particular git repository / branch.

I'm not sure how to do that. Currently, running pip install -r requirements.txt breaks at the package that is to be installed from git directly. So, when it breaks, I issue the install command manually, and run pip install -r requirements.txt again. This is bad for automation, and on-boarding new dev's to my project because the new guys have to ingest the hack as well as the project code. Ideally, I want to run the install command once.

0

There are 0 answers