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

PoC: update PythonPackage easyblock to build wheel first when installing Python package with pip #3068

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

Flamefire
Copy link
Contributor

@Flamefire Flamefire commented Jan 5, 2024

(created using eb --new-pr)

This is a Proof of Concept only.

It adds the option to set use_pip = 'wheel' which matches more our build-test-install cycle.

Currently when using pip we have this:

  • build step does nothing
  • test step installs into a temporary directory with pip install --prefix /tmp/foo .
  • install step installs to the final location with pip install --prefix /final/foo .

Confusingly all build options need to be passed to (pre)installopts and as Python usually creates a "wheel file" (basically a compiled, installable zip) this duplicates work.

This option when set does the following:

  • build step: pip wheel --wheel-dir /new-tmp-dir
  • test step installs into a temporary directory with pip install --prefix /tmp/foo /new-tmp-dir/*.whl
  • install step installs to the final location with pip install --prefix /final/foo /new-tmp-dir/*.whl

This avoids duplicate work and ensures that what is tested is what gets installed (currently we build twice which could yield different results). It is also nice to have separate timing and output for the actual build

However it turned out a bit more involved than anticipated. E.g. not all options for pip install apply to pip wheel and vice versa. Also the time savings are not that great. I tested PyTorch 2.1.2 on a (admittedly high-cpu) machine. And after an initial build/install the times are:

  • setup.py install: ~35s
  • pip install .: ~63s
  • pip install *.whl: ~17s

So the time saving is around 11s which IMO isn't worth the added complexity.
However it brings back a dedicated build step, which shows up as such in EB status/progress and not confusingly in the test or install step.

@Flamefire Flamefire marked this pull request as draft January 5, 2024 11:33
@boegel boegel added this to the 5.0 milestone Jan 17, 2024
@boegel boegel changed the title PoC: Build wheel first when installing Python package with pip PoC: update PythonPackage eaysyblock to build wheel first when installing Python package with pip Jan 17, 2024
@boegel boegel changed the title PoC: update PythonPackage eaysyblock to build wheel first when installing Python package with pip PoC: update PythonPackage easyblock to build wheel first when installing Python package with pip Jan 17, 2024
Check that replacement actually happens and wheel files are created.
Also change config values for following install step(s).
@Flamefire Flamefire force-pushed the 20240105123332_new_pr_pythonpackage branch from 3b1123c to 30fb1bc Compare January 19, 2024 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants