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

Use 'python -m pip' instead of 'pip' for package installs. #262

Closed
AGeekInside opened this issue Nov 6, 2019 · 4 comments · Fixed by #363
Closed

Use 'python -m pip' instead of 'pip' for package installs. #262

AGeekInside opened this issue Nov 6, 2019 · 4 comments · Fixed by #363

Comments

@AGeekInside
Copy link
Contributor

How would this feature be useful?
Using 'python -m pip' makes sure that the package installation is going into the expected python environment.

Describe the solution you'd like
Line 306 of sessions.py is where the install command runs 'pip'. I think a good solution would be to have the nox work simply run 'python -m pip' instead.

@theacodes
Copy link
Collaborator

theacodes commented Nov 6, 2019 via email

@AGeekInside
Copy link
Contributor Author

AGeekInside commented Nov 6, 2019

Probably not necessary. I did make a fork to try out making the change, and it was easy enough, but it'll be purely cosmetic given the factors you pointed out.

I think the only argument to be made (weak as it is) is that it might be a good thing to adopt the best practice of 'python -m pip', but that doesn't seem like a huge benefit.

@theacodes
Copy link
Collaborator

theacodes commented Nov 6, 2019 via email

@itsayellow
Copy link

This does have a concrete benefit. On Windows, pip install --upgrade pip will fail (because Windows won't allow pip to be uninstalled if its binary is being used) but python -m pip install --upgrade pip succeeds fine.

pipx recently had to switch its noxfile statement from

session.install("--upgrade", "pip")

to

session.run("python", "-m", "pip", "install", "--upgrade", "pip")

Because the original would crash if Windows actually needed to upgrade pip.
pypa/pipx#576

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

Successfully merging a pull request may close this issue.

3 participants