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

[ci] ask pip to always install local artifact but not download package from PyPI #6574

Merged
merged 11 commits into from
Jul 29, 2024
9 changes: 7 additions & 2 deletions build-python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -359,14 +359,19 @@ fi
if test "${INSTALL}" = true; then
echo "--- installing lightgbm ---"
cd ../dist
if test "${BUILD_WHEEL}" = true; then
PACKAGE_NAME="lightgbm*.whl"
else
PACKAGE_NAME="lightgbm*.tar.gz"
fi
# ref for use of '--find-links': https://stackoverflow.com/a/52481267/3986677
pip install \
${PIP_INSTALL_ARGS} \
--ignore-installed \
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--ignore-installed was added in #6526 for the following reason:

It also proposes remove the pip uninstall lightgbm in that script with passing --ignore-installed to pip install... that way the locally-built version overwrites the already-installed one every time, without generating a log message like "WARNING: Skipping lightgbm as it is not installed."

But it seems that the right flag is --force-reinstall for that.
--ignore-installed may mix old and new lightgbm installations which can result in corrupted installation. Refer to the detailed explanation here: https://stackoverflow.com/a/51916623.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, --force-reinstall is preferable now that we are also using --no-deps here (#6256).

I'd previously not wanted to use it because it applies to all dependencies, not just to the package being installed, and that led to an existing numpy or scipy being force-reinstalled too.

--force-reinstall \
--no-cache-dir \
--no-deps \
--find-links=. \
lightgbm
${PACKAGE_NAME}
cd ../
fi

Expand Down
Loading