Skip to content

Commit 93efddc

Browse files
malfetpytorchmergebot
authored andcommitted
Use pip corresponding to python executable (pytorch#141165)
Sometimes `python3` and `pip` are aliased to different runtimes, so it's better to always use `pip3`, but as linter should install packages into the same python environment, it's even better to just call sys.executable with `-mpip install XYZ` arguments Fixes regression introduced by pytorch#124033 Pull Request resolved: pytorch#141165 Approved by: https://github.com/Skylion007, https://github.com/kit1980
1 parent a82bab6 commit 93efddc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/linter/adapters/pip_init.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ def run_command(args: list[str]) -> subprocess.CompletedProcess[bytes]:
5656

5757
if uv_available:
5858
pip_args = ["uv", "pip", "install"]
59+
elif sys.executable:
60+
pip_args = [sys.executable, "-mpip", "install"]
5961
else:
60-
pip_args = ["pip", "install"]
62+
pip_args = ["pip3", "install"]
6163

6264
# If we are in a global install, use `--user` to install so that you do not
6365
# need root access in order to initialize linters.

0 commit comments

Comments
 (0)