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

Error when call_subprocess fails with show_stdout=True #3521

srinchiera opened this Issue Feb 26, 2016 · 0 comments


None yet
1 participant

srinchiera commented Feb 26, 2016

If call_subprocess in utils/ is called with show_stdout=True, and the subprocess fails, pip errors out with UnboundLocalError: local variable 'all_output' referenced before assignment.

To avoid this, it should not try to print all_output when called when show_stdout=True. In this case, the process's stdout will already be printed to the console.

Discovered using this command:

$ pip install git+ssh://
Collecting git+ssh://
  Cloning ssh:// (to 0.2.1) to /tmp/pip-8k63_T-build
ssh: Could not resolve hostname 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.
git clone -q ssh:// /tmp/pip-8k63_T-build
  Complete output from command git clone -q ssh:// /tmp/pip-8k63_T-build:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pip/", line 209, in main
    status =, args)
  File "/usr/lib/python2.7/site-packages/pip/commands/", line 299, in run
  File "/usr/lib/python2.7/site-packages/pip/req/", line 359, in prepare_files
  File "/usr/lib/python2.7/site-packages/pip/req/", line 576, in _prepare_file
    session=self.session, hashes=hashes)
  File "/usr/lib/python2.7/site-packages/pip/", line 793, in unpack_url
    unpack_vcs_link(link, location)
  File "/usr/lib/python2.7/site-packages/pip/", line 474, in unpack_vcs_link
  File "/usr/lib/python2.7/site-packages/pip/vcs/", line 283, in unpack
  File "/usr/lib/python2.7/site-packages/pip/vcs/", line 124, in obtain
    self.run_command(['clone', '-q', url, dest])
  File "/usr/lib/python2.7/site-packages/pip/vcs/", line 322, in run_command
  File "/usr/lib/python2.7/site-packages/pip/utils/", line 712, in call_subprocess
    ''.join(all_output) +
UnboundLocalError: local variable 'all_output' referenced before assignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment