pip tries to use git when git is not installed

git, pip, python

Solution

Unfortunately, no. There is no config option to enable/disable backends.

Details, found by digging in the code:

Git module is always registered: In pip/install.py, the git module is imported. At the end of it, it registers itself, and will thus be queried whenever one of the schemes declared in ´git.Git´ matches the url of the dependency.

schemes = ('git', 'git+http', 'git+https', 'git+ssh', 'git+git', 'git+file')

Exception is not handled Funnily, freezing anticipates that an error might occur when determining the dependency url to be frozen. Excerpt from pip.FrozenRequirement:

try:
    req = get_src_requirement(dist, location, find_tags)
except InstallationError:
    logger.warn("Error when trying to get requirement for VCS system %s, falling back to uneditable format" % ex)

InstallationError inherits from PipError. Unfortunately, an exception of type ´BadCommand´ is raised, which inherits from ´PipError´.

So, aside from hacking the source: Nothing you can do. If you need this to work, you need to install git, hack the source, or simulate a git executable. If you go for the latter, for starters you need to fake ´git config remote.origin.url´, which is called (and fails) in pip.vcs.git.Git.get_url.

Hope that helps, even though it's not a yes. ;)

Problem

I have a project folder that is a git repository (has a .git folder). When I use the command `pip freeze`, pip tries to use git. However, I don't have git installed on my system so this causes an error: ``` (env) PS C:\Users\eclaird\work\myproject> pip freeze Cannot find command 'git' Storing complete log in C:\Users\eclaird\pip\pip.log (env) PS C:\Users\eclaird\work\myproject> ``` pip.log: ``` ------------------------------------------------------------ C:\Users\eclaird\work\env\Scripts\pip-script.py run on 01/09/14 11:54:42 Cannot find command 'git' Exception information: Traceback (most recent call last): File "C:\Users\eclaird\work\env\lib\site-packages\pip\basecommand.py", line 134, in main status = self.run(options, args) File "C:\Users\eclaird\work\env\lib\site-packages\pip\commands\freeze.py", line 73, in run req = pip.FrozenRequirement.from_dist(dist, dependency_links, find_tags=find_tags) File "C:\Users\eclaird\work\env\lib\site-packages\pip\__init__.py", line 180, in from_dist req = get_src_requirement(dist, location, find_tags) File "C:\Users\eclaird\work\env\lib\site-packages\pip\vcs\__init__.py", line 249, in get_src_requirement return version_control().get_src_requirement(dist, location, find_tags) File "C:\Users\eclaird\work\env\lib\site-packages\pip\vcs\git.py", line 151, in get_src_requirement repo = self.get_url(location) File "C:\Users\eclaird\work\env\lib\site-packages\pip\vcs\git.py", line 122, in get_url [self.cmd, 'config', 'remote.origin.url'], File "C:\Users\eclaird\work\env\lib\site-packages\pip\vcs\__init__.py", line 110, in cmd command = find_command(self.name) File "C:\Users\eclaird\work\env\lib\site-packages\pip\util.py", line 108, in find_command raise BadCommand('Cannot find command %r' % cmd) BadCommand: Cannot find command 'git' ``` Is there a way to disable the git integration in pip? (pip 1.4.1, Python 2.7.6)

Original source