Skip to content

Commit

Permalink
Fix index when installing torch through smart build (#449)
Browse files Browse the repository at this point in the history
Torch changed something in their indexing when trying to install from
their provided wheels. This updates the `pip install` command within
`smart build` to ensure that the appropriate packages can be found.

[ committed by @ashao ]
[ reviewed by @ankona ]
  • Loading branch information
ashao authored Jan 8, 2024
1 parent 142ddc1 commit 8fd7160
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions smartsim/_core/_cli/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,10 @@ def build_redis_ai(
logger.info("ML Backends and RedisAI build complete!")


def check_py_torch_version(versions: Versioner, device: _TDeviceStr = "cpu") -> None:
def check_py_torch_version(versions: Versioner, device_in: _TDeviceStr = "cpu") -> None:
"""Check Python environment for TensorFlow installation"""

device = device_in.lower()
if BuildEnv.is_macos():
if device == "gpu":
raise BuildError("SmartSim does not support GPU on MacOS")
Expand Down Expand Up @@ -260,10 +261,11 @@ def check_py_torch_version(versions: Versioner, device: _TDeviceStr = "cpu") ->
"Torch version not found in python environment. "
"Attempting to install via `pip`"
)
wheel_device = device if device == "cpu" else device_suffix.replace("+","")
pip(
"install",
"-f",
"https://download.pytorch.org/whl/torch_stable.html",
"--extra-index-url",
f"https://download.pytorch.org/whl/{wheel_device}",
*(f"{package}=={version}" for package, version in torch_deps.items()),
)
elif missing or conflicts:
Expand Down

0 comments on commit 8fd7160

Please sign in to comment.