Skip to content

Commit 634609a

Browse files
committed
Fix pip installing to system Miniconda on Windows, revert 0132966
1 parent 40f1837 commit 634609a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

one_click.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,13 @@ def get_gpu_choice():
111111
def get_pytorch_install_command(gpu_choice):
112112
"""Get PyTorch installation command based on GPU choice"""
113113
base_cmd = f"python -m pip install torch=={TORCH_VERSION} "
114-
pypi_fallback = " --extra-index-url https://pypi.org/simple/"
115114

116115
if gpu_choice == "NVIDIA_CUDA128":
117-
return base_cmd + "--index-url https://download.pytorch.org/whl/cu128" + pypi_fallback
116+
return base_cmd + "--index-url https://download.pytorch.org/whl/cu128"
118117
elif gpu_choice == "AMD":
119-
return base_cmd + "--index-url https://download.pytorch.org/whl/rocm6.4" + pypi_fallback
118+
return base_cmd + "--index-url https://download.pytorch.org/whl/rocm6.4"
120119
elif gpu_choice in ["APPLE", "NONE"]:
121-
return base_cmd + "--index-url https://download.pytorch.org/whl/cpu" + pypi_fallback
120+
return base_cmd + "--index-url https://download.pytorch.org/whl/cpu"
122121
elif gpu_choice == "INTEL":
123122
if is_linux():
124123
return "python -m pip install torch==2.1.0a0 intel-extension-for-pytorch==2.1.10+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/"
@@ -131,17 +130,16 @@ def get_pytorch_install_command(gpu_choice):
131130
def get_pytorch_update_command(gpu_choice):
132131
"""Get PyTorch update command based on GPU choice"""
133132
base_cmd = f"python -m pip install --upgrade torch=={TORCH_VERSION} "
134-
pypi_fallback = " --extra-index-url https://pypi.org/simple/"
135133

136134
if gpu_choice == "NVIDIA_CUDA128":
137-
return f"{base_cmd}--index-url https://download.pytorch.org/whl/cu128" + pypi_fallback
135+
return f"{base_cmd} --index-url https://download.pytorch.org/whl/cu128"
138136
elif gpu_choice == "AMD":
139-
return f"{base_cmd}--index-url https://download.pytorch.org/whl/rocm6.4" + pypi_fallback
137+
return f"{base_cmd} --index-url https://download.pytorch.org/whl/rocm6.4"
140138
elif gpu_choice in ["APPLE", "NONE"]:
141-
return f"{base_cmd}--index-url https://download.pytorch.org/whl/cpu" + pypi_fallback
139+
return f"{base_cmd} --index-url https://download.pytorch.org/whl/cpu"
142140
elif gpu_choice == "INTEL":
143141
intel_extension = "intel-extension-for-pytorch==2.1.10+xpu" if is_linux() else "intel-extension-for-pytorch==2.1.10"
144-
return f"{base_cmd}{intel_extension} --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/"
142+
return f"{base_cmd} {intel_extension} --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/"
145143
else:
146144
return base_cmd
147145

@@ -196,6 +194,8 @@ def run_cmd(cmd, assert_success=False, environment=False, capture_output=False,
196194
if environment:
197195
if is_windows():
198196
conda_bat_path = os.path.join(script_dir, "installer_files", "conda", "condabin", "conda.bat")
197+
python_path = os.path.join(conda_env_path, "python.exe")
198+
cmd = cmd.replace("python ", f'"{python_path}" ')
199199
cmd = f'"{conda_bat_path}" activate "{conda_env_path}" >nul && {cmd}'
200200
else:
201201
conda_sh_path = os.path.join(script_dir, "installer_files", "conda", "etc", "profile.d", "conda.sh")

0 commit comments

Comments
 (0)