'pipenv install' fails with 'ssh: Could not resolve hostname my.domain.com:gitlab_username Name or service not known'
See original GitHub issueIssue description
‘pipenv install’ fails since version 2018.6.25 if the Pipfile contains a package reference to a Gitlab repository, like e.g.: my_package = {git = "git@my.domain.com:gitlab_username/my_package.git", ref = "master"}
Here, my.domain.com is a replacement for the properly resolving domain.
Downgrading to 2018.5.18 resolves the issue.
Expected result
It should install ‘my_package’.
Actual result
Obtaining my_package from git+ssh://git@my.domain.com:gitlab_username/my_package.git@856f8ff9146dc7fbfc1ae3595203a9f3af8cf023#egg=my_package
Cloning ssh://git@my.domain.com:gitlab_username/my_package.git (to revision 856f8ff9146dc7fbfc1ae3595203a9f3af8cf023) to /home/me/.local/share/virtualenvs/my_project-WRKZN-2y/src/my_package
ssh: Could not resolve hostname my.domain.com:gitlab_username: Name or service not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Command "git clone -q ssh://git@my.domain.com:gitlab_username/my_package.git /home/me/.local/share/virtualenvs/my_project-WRKZN-2y/src/my_package" failed with error code 128 in None
pipenv seems to append ‘:gitlab_username’ to the domain name and as a result fails to resolve the hostname.
Steps to replicate
Replace git@my.domain.com:gitlab_username/my_package.git correspondingly and run pipenv install
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[requires]
python_version = "2.7"
[dev-packages]
[packages]
my_package = {ref = "v1.0.0", git = "git@my.domain.com:gitlab_username/my_package.git", editable = true}
$ pipenv --support
Pipenv version: '2018.7.1'
Pipenv location: '/home/me/.local/share/virtualenvs/my_project-WRKZN-2y/local/lib/python2.7/site-packages/pipenv'
Python location: '/home/me/.local/share/virtualenvs/my_project-WRKZN-2y/bin/python2.7'
Other Python installations in PATH
:
-
2.7
:/home/me/.local/share/virtualenvs/my_project-WRKZN-2y/bin/python2.7
-
2.7
:/home/me/.local/share/virtualenvs/my_project-WRKZN-2y/bin/python2.7
-
2.7
:/usr/bin/python2.7
-
3.6
:/usr/bin/python3.6m
-
3.6
:/usr/bin/python3.6
-
2.7.14
:/home/me/.local/share/virtualenvs/my_project-WRKZN-2y/bin/python
-
2.7.15
:/usr/bin/python
-
2.7.14
:/home/me/.local/share/virtualenvs/my_project-WRKZN-2y/bin/python2
-
2.7.15
:/usr/bin/python2
-
3.6.5
:/usr/bin/python3
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '0',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '4.15.0-24-generic',
'platform_system': 'Linux',
'platform_version': '#26-Ubuntu SMP Wed Jun 13 08:44:47 UTC 2018',
'python_full_version': '2.7.14',
'python_version': '2.7',
'sys_platform': 'linux2'}
Pipenv–specific environment variables:
PIPENV_ACTIVE
:1
Debug–specific environment variables:
PATH
:/home/me/.local/share/virtualenvs/my_project-WRKZN-2y/bin:/home/me/.rvm/gems/ruby-2.4.1/bin:/home/me/.rvm/gems/ruby-2.4.1@global/bin:/home/me/.rvm/rubies/ruby-2.4.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/me/.rvm/bin:/home/me/.rvm/bin:/home/me/.local/bin:/home/me/.rvm/bin:/home/me/.local/bin
SHELL
:/usr/bin/zsh
LANG
:en_US.UTF-8
PWD
:/home/me/projects/my_project
VIRTUAL_ENV
:/home/me/.local/share/virtualenvs/my_project-WRKZN-2y
Contents of Pipfile
(‘/home/me/projects/my_project/Pipfile’):
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[requires]
python_version = "2.7"
[dev-packages]
[packages]
my_package = {ref = "v1.0.0", git = "git@my.domain.com:gitlab_username/my_package.git", editable = true}
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
After spending multiple hours not knowing why my installation of a private GitHub repo via ssh was failing I came across this unassuming StackOverflow answer. I’d recommend adding something like this to the pipenv docs so that people can avoid this pain–it’s a tough issue to track down!
If you want to install via ssh (say, for a private repo), you’ll need to modify the GitHub ssh url as follows:
Correct:
git@github.com/coltonbh/my-package.git
Incorrect:
git@github.com:coltonbh/my-package.git
(This is the URL GitHub provides on a repo’s main page)And the install looks like:
pipenv install -e "git+ssh://git@github.com/coltonbh/my-package.git@branch123#egg=mypgk"
Otherwise you’ll get a very long install process followed by the cryptic error:
pipenv.patched.notpip._internal.exceptions.InstallationError: Command “git clone -q ssh://git@github.com:coltonbh/my-package.git /var/folders/w2/rkn1bm3d3ndclys0f81clbfw0000gn/T/requirementslib5mkvyj4m/mypgk” failed with error code 128 in None
I assume you have noticed the exception is totally different from the top post? I don’t want to sound like an asshole, but please don’t just come in and tag people without actually thinking things through. It is really not good for anyone’s productivity.