Skip to content

pip install crashes can easily confuse newbies #1250

Closed

Description

@asottile

those that are not familiar with the usual annoying messaging that pip presents can get pretty easily confused by the output that happens when pip fails to install

here's an example:

$ pre-commit run flake8 --all-files
[INFO] Initializing environment for https://gitlab.com/pycqa/flake8:flake8-walrus.
[INFO] Installing environment for https://gitlab.com/pycqa/flake8.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: Command: ('/home/asottile/.cache/pre-commit/repoi6ij0tyu/py_env-python3/bin/python', '/home/asottile/.cache/pre-commit/repoi6ij0tyu/py_env-python3/bin/pip', 'install', '.', 'flake8-walrus')
Return code: 1
Expected return code: 0
Output: 
    Processing /home/asottile/.cache/pre-commit/repoi6ij0tyu
    Collecting flake8-walrus
    
Errors: 
      ERROR: Could not find a version that satisfies the requirement flake8-walrus (from versions: none)
    ERROR: No matching distribution found for flake8-walrus
    WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.
    
Check the log at /home/asottile/.cache/pre-commit/pre-commit.log

this ~admittedly is a bit garbled for a number of reasons:

  • pip's error message here isn't great (it could say something about python_requires or that there are versions available for other versions) (the actual error is that the python is python3.6 and the plugin requires python3.8)
  • pip is out of date (when is it not? but admittedly who cares) -- this is what a lot of people try and fix -- unfortunately there's not really anything to fix here, the version of pip is from inside the virtualenv and doesn't really matter all that much
  • pre-commit is currently splitting the output from stdout and stderr making it harder to read what's going on

I can't really fix the first one, and the second one I could silence but it doesn't quite feel like the right thing to do (and admittedly knowing the pip version is sometimes useful when debugging). The third however I can pretty easily fix!

Activity

  1. asottile commented on Dec 24, 2019

    @asottile
    MemberAuthor

    while actually implementing this, it turns out that combining stdout / stderr presents a pretty easy footgun in some cases (where pre-commit collects the output from a subprocess) so I'm probably just going to s/Errors/Stderr/ (and commit the other cleanups I found while doing this)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions