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

[python-package] avoid overwriting dependencies via 'build-python.sh install' #6526

Merged
merged 3 commits into from
Jul 10, 2024

Conversation

jameslamb
Copy link
Collaborator

@jameslamb jameslamb commented Jul 7, 2024

Building a Python wheel + installing it like this:

sh build-python.sh bdist_wheel install

Will also overwrite numpy and scipy in the installation environment. When working in a conda environment, that'll also replace conda's numpy / scipy with a wheel from PyPI... which can sometimes lead to undesirable consequences like failed imports.

This could be avoided by just building a wheel yourself and then installing it + telling pip not to overwrite any dependencies, like this:

sh build-python.sh bdist_wheel
pip install --no-deps dist/*.whl

This PR proposes just making that the default behavior, to make local development a bit easier.

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."

Copy link
Collaborator

@StrikerRUS StrikerRUS left a comment

Choose a reason for hiding this comment

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

LGTM!

@StrikerRUS StrikerRUS merged commit 6c76b6b into master Jul 10, 2024
41 checks passed
@StrikerRUS StrikerRUS deleted the pip-no-deps branch July 10, 2024 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants