Skip to content

[python-package] ensure 'build-python.sh' always reinstalls (fixes #5906)#5907

Merged
jameslamb merged 2 commits intomasterfrom
python/force-reinstall
Jun 10, 2023
Merged

[python-package] ensure 'build-python.sh' always reinstalls (fixes #5906)#5907
jameslamb merged 2 commits intomasterfrom
python/force-reinstall

Conversation

@jameslamb
Copy link
Collaborator

Fixes #5906.

On master, build-python.sh install will not update the installed version of lightgbm if that version has already been installed. For example:

sh build-python.sh install
sh build-python.sh install
# Requirement already satisfied: lightgbm in  ../mambaforge/lib/python3.9/site-packages (3.3.5.99)

This PR proposes modifying build-python.sh such that it'll always install the version it's just built, regardless of what's already installed. I think that is closer to what is expected when building from sources cloned from GitHub, and it also makes local development a bit more reliable and convenient (no need to pip uninstall each time you rebuild).

Notes for Reviewers

The relevant code for installing with --precompile doesn't need to change, as python setup.py install will always reinstall over an existing version.

python setup.py install ${PIP_INSTALL_ARGS} --precompile

@jameslamb jameslamb requested a review from jmoralez June 4, 2023 04:37
@jameslamb jameslamb changed the title [python-package] ensure 'build-python.sh' always reinstalls (fixes #5906) WIP: [python-package] ensure 'build-python.sh' always reinstalls (fixes #5906) Jun 5, 2023
@jameslamb jameslamb marked this pull request as draft June 5, 2023 03:11
@jameslamb jameslamb changed the title WIP: [python-package] ensure 'build-python.sh' always reinstalls (fixes #5906) [python-package] ensure 'build-python.sh' always reinstalls (fixes #5906) Jun 10, 2023
@jameslamb jameslamb marked this pull request as ready for review June 10, 2023 05:21
@jameslamb jameslamb merged commit b859f7b into master Jun 10, 2023
@jameslamb jameslamb deleted the python/force-reinstall branch June 10, 2023 14:20
@github-actions
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[python-package] Build from Sources failed

2 participants