Skip to content

Commit

Permalink
Install python dependencies with a single pip install (#5082)
Browse files Browse the repository at this point in the history
* do not run pip install multiple times

Signed-off-by: harupy <hkawamura0130@gmail.com>

* do not run pip install when requirements is empty

Signed-off-by: harupy <hkawamura0130@gmail.com>

* fix if syntax

Signed-off-by: harupy <hkawamura0130@gmail.com>

* rename

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
  • Loading branch information
harupy committed Jan 7, 2022
1 parent 53189c2 commit cef0ba6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions dev/install-common-deps.sh
Expand Up @@ -27,18 +27,19 @@ else
fi
export MLFLOW_HOME=$(pwd)

req_files=""
# Install Python test dependencies only if we're running Python tests
if [[ "$INSTALL_SMALL_PYTHON_DEPS" == "true" ]]; then
# When downloading large packages from PyPI, the connection is sometimes aborted by the
# remote host. See https://github.com/pypa/pip/issues/8510.
# As a workaround, we retry installation of large packages.
retry-with-backoff pip install -r requirements/small-requirements.txt
req_files+=" -r requirements/small-requirements.txt"
fi
if [[ "$INSTALL_SKINNY_PYTHON_DEPS" == "true" ]]; then
retry-with-backoff pip install -r requirements/skinny-requirements.txt
req_files+=" -r requirements/skinny-requirements.txt"
fi
if [[ "$INSTALL_LARGE_PYTHON_DEPS" == "true" ]]; then
retry-with-backoff pip install -r requirements/large-requirements.txt
req_files+=" -r requirements/large-requirements.txt"

# Install prophet's dependencies beforehand, otherwise pip would fail to build a wheel for prophet
if [[ -z "$(pip cache list prophet --format abspath)" ]]; then
Expand All @@ -49,7 +50,11 @@ if [[ "$INSTALL_LARGE_PYTHON_DEPS" == "true" ]]; then
rm -rf $tmp_dir
fi

retry-with-backoff pip install -r requirements/extra-ml-requirements.txt
req_files+=" -r requirements/extra-ml-requirements.txt"
fi

if [[ ! -z $req_files ]]; then
retry-with-backoff pip install $req_files
fi

# Install `mlflow-test-plugin` without dependencies
Expand Down

0 comments on commit cef0ba6

Please sign in to comment.