question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'pipenv install' fails with 'ssh: Could not resolve hostname my.domain.com:gitlab_username Name or service not known'

See original GitHub issue
Issue 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:closed
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

15reactions
coltonbhcommented, Mar 21, 2020

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:

git@github.com:coltonbh/my-package.git (fetch)
              ^ change this to a '/' character

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

5reactions
uranusjrcommented, Sep 26, 2018

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'git clone ...' works but not 'pip install ...' for the same remote url
and outputs the following error: ssh: Could not resolve hostname remoteurl:username: Name or service not known fatal: Could not read ...
Read more >
ssh: Could not resolve hostname server: Name or ... - YouTube
ssh : Could not resolve hostname server: Name or service not known (2 Solutions!)Helpful? Please support me on Patreon: ...
Read more >
how to fix ssh or ping; could not resolve hostname - YouTube
This video shows how to resolve the common errors : " could not resolve ... could not resolve hostname ; name or service...
Read more >
how to fix ''Unable to resolve host'' error on kali Linux - YouTube
kali2020,#unabletoresolvehost,#hosterrorThis video shows how to fix unable to resolve host in linux. This always happens after host - name ...
Read more >
How To Fix The Unable To Resolve Host Error On ... - YouTube
For More Information Click The Link To My Website http://www.fuzzthepiguy.tech/===========...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found