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

pip install crashes can easily confuse newbies #1250

Closed
asottile opened this issue Dec 24, 2019 · 1 comment
Closed

pip install crashes can easily confuse newbies #1250

asottile opened this issue Dec 24, 2019 · 1 comment
Labels

Comments

@asottile
Copy link
Member

@asottile asottile commented Dec 24, 2019

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!

@asottile asottile added the cleanup label Dec 24, 2019
@asottile
Copy link
Member Author

@asottile asottile commented Dec 24, 2019

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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

1 participant
You can’t perform that action at this time.