[python-package] avoid overwriting dependencies via 'build-python.sh install' #6526
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Building a Python wheel + installing it like this:
Will also overwrite
numpy
andscipy
in the installation environment. When working in a conda environment, that'll also replace conda'snumpy
/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
topip 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."