I am trying to add a package to my requirements.txt
file that is:
ssh
configured for the private repomaster
, whose name has a slash in itssh
protocolAll over the internet, there are questions on this topic. Here are the pip
docs on this:
pip install -e "vcs+protocol://repo_url/#egg=pkg&subdirectory=pkg_dir"
And an answer for GitHub from How to state in requirements.txt a direct github source
git+git://github.com/path/to/package-two@master#egg=package-two
Attempt Method #1
I am trying to use this answer in my requirements.txt
file:
-e git+ssh://github.com/Organization/repo-name.git@branch/name#egg=foo
I am getting an error:
ERROR: Command errored out with exit status 128: git clone -q ssh://github.com/Organization/repo-name.git /path/to/venv/src/foo Check the logs for full command output.
And when I view the logs using the --log
option:
Using pip 20.2 from /path/to/venv/lib/python3.8/site-packages/pip (python 3.8)
Non-user install because user site-packages disabled
Created temporary directory: /private/var/folders/yl/tnzf__856m90wwx0jrqwmhbw0000gn/T/pip-ephem-wheel-cache-yysggsvl
Created temporary directory: /private/var/folders/yl/tnzf__856m90wwx0jrqwmhbw0000gn/T/pip-req-tracker-ckqzav7i
Initialized build tracking at /private/var/folders/yl/tnzf__856m90wwx0jrqwmhbw0000gn/T/pip-req-tracker-ckqzav7i
Created build tracker: /private/var/folders/yl/tnzf__856m90wwx0jrqwmhbw0000gn/T/pip-req-tracker-ckqzav7i
Entered build tracker: /private/var/folders/yl/tnzf__856m90wwx0jrqwmhbw0000gn/T/pip-req-tracker-ckqzav7i
Created temporary directory: /private/var/folders/yl/tnzf__856m90wwx0jrqwmhbw0000gn/T/pip-install-c9xw78wg
Looking in indexes: https://pypi.org/simple
Obtaining foo from git+ssh://github.com/Organization/repo-name.git@branch/name#egg=foo (from -r requirements.txt (line 6))
Cloning ssh://github.com/Organization/repo-name.git (to revision branch/name) to ./venv/src/foo
ERROR: Command errored out with exit status 128: git clone -q ssh://github.com/Organization/repo-name.git /path/to/venv/src/foo Check the logs for full command output.
Exception information:
Traceback (most recent call last):
File "/path/to/venv/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 216, in _main
status = self.run(options, args)
File "/path/to/venv/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 182, in wrapper
return func(self, options, args)
File "/path/to/venv/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 324, in run
requirement_set = resolver.resolve(
File "/path/to/venv/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 183, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "/path/to/venv/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 388, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/path/to/venv/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 326, in _get_abstract_dist_for
return self.preparer.prepare_editable_requirement(req)
File "/path/to/venv/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 523, in prepare_editable_requirement
req.update_editable(not self._download_should_save)
File "/path/to/venv/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 664, in update_editable
vcs_backend.obtain(self.source_dir, url=hidden_url)
File "/path/to/venv/lib/python3.8/site-packages/pip/_internal/vcs/versioncontrol.py", line 641, in obtain
self.fetch_new(dest, url, rev_options)
File "/path/to/venv/lib/python3.8/site-packages/pip/_internal/vcs/git.py", line 230, in fetch_new
self.run_command(make_command('clone', '-q', url, dest))
File "/path/to/venv/lib/python3.8/site-packages/pip/_internal/vcs/versioncontrol.py", line 771, in run_command
return call_subprocess(cmd, cwd,
File "/path/to/venv/lib/python3.8/site-packages/pip/_internal/vcs/versioncontrol.py", line 166, in call_subprocess
raise SubProcessError(exc_msg)
pip._internal.exceptions.SubProcessError: Command errored out with exit status 128: git clone -q ssh://github.com/Organization/repo-name.git /path/to/venv/src/foo Check the logs for full command output.
Removed build tracker: '/private/var/folders/yl/tnzf__856m90wwx0jrqwmhbw0000gn/T/pip-req-tracker-ckqzav7i'
Attempt Method #2
Another way I try for requirements.txt
:
-e git+git@github.com:Organization/repo-name.git#egg=foo
The cloning in this actually works! It also prints this warning: DEPRECATION: This form of VCS requirement is being deprecated
Unfortunately, I cannot figure out how to specify a branch name in this format.
What am I doing wrong? Am I missing something?
FYI, my versions:
Python==3.8.5
pip==20.2
setuptools==47.1.0
I figured out my problem in both cases... syntax
Attempt #1
Mistake: needed to say git@github.com
Correct method:
-e git+ssh://git@github.com/Organization/repo-name.git@branch/name#egg=foo
Attempt #2
Mistake: didn't know one can use @
twice
Correct method:
-e git+git@github.com:Organization/repo-name.git@branch/name#egg=foo