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

Using pip from your program: wrong command #7008

Closed
ghost opened this issue Sep 12, 2019 · 6 comments · Fixed by #7917
Closed

Using pip from your program: wrong command #7008

ghost opened this issue Sep 12, 2019 · 6 comments · Fixed by #7917
Labels
auto-locked Outdated issues that have been locked by automation state: awaiting PR Feature discussed, PR is needed type: docs Documentation related type: question User question

Comments

@ghost
Copy link

ghost commented Sep 12, 2019

In the documentation, there is a mistake in the subprocess command at the bottom of the page.

https://pip.pypa.io/en/stable/user_guide/#using-pip-from-your-program

The first command is: subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'my_package']) which works fine.

But the second is: reqs = subprocess.check_output([sys.executable, '-m', 'pip', 'freeze'])
And should be: reqs = subprocess.check_output([sys.executable, '-m', 'pip', 'install', 'freeze'])

@triage-new-issues triage-new-issues bot added the S: needs triage Issues/PRs that need to be triaged label Sep 12, 2019
@pfmoore
Copy link
Member

pfmoore commented Sep 12, 2019

Why? That would run pip install freeze which is installing a package freeze, whereas the current code runs pip freeze which is something you'd want to capture the output from, and so is a better example...

@pradyunsg pradyunsg added type: question User question and removed S: needs triage Issues/PRs that need to be triaged labels Sep 12, 2019
@pradyunsg
Copy link
Member

Hey there @Drugong! Thanks for filing this issue.

pip has multiple commands (like install) and freeze is one such command. We have a reference list of pip's commands at https://pip.pypa.io/en/latest/reference/.

I think your suggestion stems from an understanding that pip does not have a freeze command, but as @pfmoore pointed out, it does. :)

@chrahunt
Copy link
Member

I think the way it is currently worded one might expect the same command to be used in both examples. We might expand on the text to indicate that we did actually mean to put freeze there for the reason @pfmoore stated.

@chrahunt chrahunt added state: awaiting PR Feature discussed, PR is needed type: docs Documentation related labels Sep 17, 2019
@deveshks
Copy link
Contributor

Hi @chrahunt

I think we can change the current text which says

If you want to process the output further, use one of the other APIs in the module:

to

If you want to process the output further, use one of the other APIs in the module. We are using https://pip.pypa.io/en/latest/reference/pip_freeze/ here which outputs installed packages in requirements format.

If that change is something what you meant if your comment above, I can create a PR for the same.

@pfmoore
Copy link
Member

pfmoore commented Mar 28, 2020

That sounds like a reasonable clarification to add.

@deveshks
Copy link
Contributor

Thanks @pfmoore for your comment. I have added a PR to add this explanation

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label May 5, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation state: awaiting PR Feature discussed, PR is needed type: docs Documentation related type: question User question
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants