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

Replace inline pip install with pip install from requirements*.txt #21106

Merged
merged 13 commits into from
Jul 22, 2024
27 changes: 12 additions & 15 deletions tools/ci_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,6 @@ def convert_arg_line_to_args(self, arg_line):
"--wheel_name_suffix",
help="Suffix to append to created wheel names. This value is currently only used for nightly builds.",
)
parser.add_argument(
jchen351 marked this conversation as resolved.
Show resolved Hide resolved
"--numpy_version", help="Installs a specific version of numpy before building the python binding."
)
parser.add_argument("--skip-keras-test", action="store_true", help="Skip tests with Keras if keras is installed")

# C-Sharp bindings
Expand Down Expand Up @@ -870,16 +867,6 @@ def update_submodules(source_dir):
run_subprocess(["git", "submodule", "update", "--init", "--recursive"], cwd=source_dir)


def install_python_deps(numpy_version=""):
dep_packages = ["setuptools", "wheel", "pytest"]
dep_packages.append(f"numpy=={numpy_version}" if numpy_version else "numpy>=1.16.6")
dep_packages.append("sympy>=1.10")
dep_packages.append("packaging")
dep_packages.append("cerberus")
dep_packages.append("psutil")
run_subprocess([sys.executable, "-m", "pip", "install", *dep_packages])


def setup_test_data(source_onnx_model_dir, dest_model_dir_name, build_dir, configs):
# create the symlink/shortcut of onnx models dir under build_dir
# currently, there're 2 sources of onnx models, one is build in OS image, another is
Expand Down Expand Up @@ -2147,7 +2134,14 @@ def run_onnxruntime_tests(args, source_dir, ctest_path, build_dir, configs):
numpy_init_version = numpy.__version__
pb_init_version = google.protobuf.__version__
run_subprocess(
[sys.executable, "-m", "pip", "install", "-r", "requirements-transformers-test.txt"],
[
sys.executable,
"-m",
"pip",
"install",
"-r",
"requirements/requirements-transformers-test.txt",
],
cwd=SCRIPT_DIR,
)
run_subprocess([sys.executable, "-m", "pytest", "transformers"], cwd=cwd)
Expand Down Expand Up @@ -2810,7 +2804,10 @@ def main():
run_subprocess([emsdk_file, "activate", emsdk_version], cwd=emsdk_dir)

if args.enable_pybind and is_windows():
install_python_deps(args.numpy_version)
run_subprocess(
[sys.executable, "-m", "pip", "install", "-r", "requirements/requirements-pybind.txt"],
cwd=SCRIPT_DIR,
)

if args.use_rocm and args.rocm_version is None:
args.rocm_version = ""
Expand Down
8 changes: 8 additions & 0 deletions tools/ci_build/requirements/requirements-pybind.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
setuptools
jchen351 marked this conversation as resolved.
Show resolved Hide resolved
wheel
pytest
numpy >= 1.19.0
snnn marked this conversation as resolved.
Show resolved Hide resolved
sympy>=1.10
packaging
cerberus
psutil
Loading