Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ghost opened this issue Jul 8, 2018 · 9 comments

Comments

@ghost
Copy link

ghost commented Jul 8, 2018

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}

@uranusjr
Copy link
Member

uranusjr commented Jul 8, 2018

I believe this is fixed by #2453 via the requirementslib upgrade. In master, not released.

@uranusjr uranusjr closed this as completed Jul 8, 2018
@pecigonzalo
Copy link

@uranusjr I believe this is still broken on the lock part.

Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
/.local/venvs/pipenv/lib/python3.7/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 335, in get_legacy_dependencies
    self.resolver.resolve(reqset)
  File "/home/gonzalo.peci/.local/venvs/pipenv/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/resolve.py", line 107, in resolve
    self._resolve_one(requirement_set, req)
  File "/home/gonzalo.peci/.local/venvs/pipenv/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/resolve.py", line 264, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/home/gonzalo.peci/.local/venvs/pipenv/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/resolve.py", line 198, in _get_abstract_dist_for
    req, self.require_hashes, self.use_user_site, self.finder,
  File "/home/gonzalo.peci/.local/venvs/pipenv/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/operations/prepare.py", line 351, in prepare_editable_requirement
    req.update_editable(not self._download_should_save)
  File "/home/gonzalo.peci/.local/venvs/pipenv/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/req/req_install.py", line 633, in update_editable
    vcs_backend.obtain(self.source_dir)
  File "/home/gonzalo.peci/.local/venvs/pipenv/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/vcs/git.py", line 187, in obtain
    self.run_command(['clone', '-q', url, dest])
  File "/home/gonzalo.peci/.local/venvs/pipenv/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/vcs/__init__.py", line 427, in run_command
    spinner=spinner)
  File "/home/gonzalo.peci/.local/venvs/pipenv/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/utils/misc.py", line 698, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pipenv.patched.notpip._internal.exceptions.InstallationError: Command "git clone -q ssh://git@github.com:org/this-package.git /tmp/tmpehxq_wdusource/this-package" failed with error code 128 in None```

@uranusjr
Copy link
Member

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.

@pecigonzalo
Copy link

I assume you know how to read, as I clearly said "i beleive" and on the lock part. I know its not the exact same issue, but it might be related, and since you are the one that closed it I decided to ask before opening a new one, I notified you so you can take a look, if need be I can open a new request if you believe its different.

The typical "i dont want to be an asshole, but ill be an asshole anyway" asshole, Is not like I came here like the typical "bad software does not work, fix your issues", I was just commenting this could still be a problem.
Tagging is just a notification or call for notice to someone, and since (I repeat) you marked this as fixed, which is completely possible, I tag you so you can check and see if this is closed or not. So please you dont go saying I did not think things through when you dont really know.

@jnsnow
Copy link

jnsnow commented Oct 25, 2019

This appears to still be broken, actually.

I'm using Pipenv 2018.11.26-7.fc30, and I'm seeing the exact same behavior:

nago@tsumi ~/s/M/repo (master)> pipenv lock
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
⠋ Pinning VCS Packages...ssh: Could not resolve hostname gitlab.com:organization: Name or service not known
fatal: Could not read from remote repository.
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
repo = {editable = true, git = "git@gitlab.com:organization/repo.git"}

Did the 2018.11 release not contain the fix candidate?

@svet-b
Copy link

svet-b commented Feb 25, 2020

Just came across this as I'm encountering the same issue with git = "git@gitlab.com:organization/repo.git" type packges. This issue (like many others) is fixed in the master branch, but not in 2018.11

@uranusjr
Copy link
Member

uranusjr commented Feb 25, 2020

pip has formally deprecated git@domain:path since 20.0, so you’re better off migrating to ssh://git@domain/path. The deprecated form will eventually stop working in Pipenv when pip completely drops support for it.

https://pip.pypa.io/en/stable/news/#id6

@coltonbh
Copy link

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

@leerobert
Copy link

@coltonbh +1000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants