Skip to content

Explicitly constraint build string for GPU packages in generated env.in files #607

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ def _create_new_version_conda_specs(
out.append(f"conda-forge::{package_name}")
else:
channel = match_out.get("channel").channel_name
# Build string of the package, like "cuda120py311h51447cc_202".
build_string = match_out.spec.split(" ")[-1]

min_version_inclusive = match_out.get("version")
assert str(min_version_inclusive).startswith("==")
Expand All @@ -167,8 +169,12 @@ def _create_new_version_conda_specs(
max_version_str = _get_dependency_upper_bound_for_runtime_upgrade(
package_name, min_version_inclusive, runtime_version_upgrade_type
)
version_constraint = f"version='>={min_version_inclusive}{max_version_str}'"
# Explicitly constraint build string for GPU packages, like PyTorch, tensorflow.
if "cuda" in build_string:
version_constraint += ",build='*cuda*'"

out.append(f"{channel}::{package_name}[version='>={min_version_inclusive}{max_version_str}']")
out.append(f"{channel}::{package_name}[{version_constraint}]")

with open(f"{new_version_dir}/{env_in_filename}", "w") as f:
f.write("# This file is auto-generated.\n")
Expand Down
Loading