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

PythonBundle should perform 1 single pip check instead of each python package repeating it #3418

Open
Micket opened this issue Aug 22, 2024 · 5 comments · May be fixed by #3428
Open

PythonBundle should perform 1 single pip check instead of each python package repeating it #3418

Micket opened this issue Aug 22, 2024 · 5 comments · May be fixed by #3428

Comments

@Micket
Copy link
Contributor

Micket commented Aug 22, 2024

Currently a bundle build has repeated

  >> running shell command:
        /apps/Test2/software/Python/3.12.3-GCCcore-13.3.0/bin/python -m pip check
        [started at: 2024-08-22 16:50:45]
        [working dir: /apps/Test2/software/Python-bundle-PyPI/2024.06-GCCcore-13.3.0]
        [output and state saved to /dev/shm/eb-ht0fx9fv/run-shell-cmd-output/python-ytqm4_tu]

due to each and every extension in the bundle doing this. But as far as i understand, this is checking the same thing every time. The bundle should do this instead, and only once (at the start)

@boegel boegel added this to the 5.0 milestone Aug 26, 2024
@boegel
Copy link
Member

boegel commented Aug 26, 2024

Yeah, this has been annoying me for a while too, but I never got around to looking into it...

pip check is indeed a general check for all installed Python packages, it doesn't check for just a single extension, so just running it once is enough

@boegel boegel changed the title PythonBundle should perform 1 single -m pip check instead of each python package repeating it PythonBundle should perform 1 single pip check instead of each python package repeating it Aug 28, 2024
@Flamefire
Copy link
Contributor

Flamefire commented Aug 29, 2024

I don't agree here that it is doing the same: Python packages have dependencies and as we specifically tell pip to not look at any dependency it is on us to make sure the order of the packages we install is correct, i.e. dependencies are installed before the dependent package. pip check would detect violations and might be able to report early when there is an issue instead of at the end.

At least that was the intention. However it looks like for PythonBundle the sanity check for each extension is run only at the end and one after an other, so the benefit of running it for each package vanishes.

Same applies to the unversioned_packages check done afterwards. Only issue I see there is the unversioned_packages EC param: I guess for extensions/pythonbundle we'd rather need to aggregate those values over all PythonPackage extensions.

Or better: Don't allow sanity_pip_check or unversioned_packages for extensions and force it in the top-level EC as it doesn't make sense to be set differently for multiple extensions: Both checks are checking everything.

Similar issue with module existence checks: easybuilders/easybuild-framework#4618

@Micket
Copy link
Contributor Author

Micket commented Aug 29, 2024

Sanity checks has always only ever run at the end of everything (including bundles), after even generating the module file and will also run after a --module-only rebuild, or a --skip --rebuild, (so redesigning bundles to run sanity checks in during the installation steps would not be easy)
pip does allow circular dependencies as well, and we do have those already, just a quick check i found Sphinx (pipdeptree --warn fail (don't understand why they call it fail, it's allowed as far as i understand))

* sphinxcontrib-serializinghtml => Sphinx => sphinxcontrib-serializinghtml
* sphinxcontrib-htmlhelp => Sphinx => sphinxcontrib-htmlhelp
* sphinxcontrib-applehelp => Sphinx => sphinxcontrib-applehelp
* sphinxcontrib-qthelp => Sphinx => sphinxcontrib-qthelp
* sphinxcontrib-devhelp => Sphinx => sphinxcontrib-devhelp
* Sphinx => sphinxcontrib-applehelp => Sphinx

so checking these one at a time would presumably fail

Yes the idea would be to disable these checks for pyhonpackage extensions and repeat it once and for all in the pythonbundle.

@Flamefire
Copy link
Contributor

I'm working on it

@Flamefire Flamefire linked a pull request Aug 29, 2024 that will close this issue
@Flamefire
Copy link
Contributor

I think I'm done: #3428

Tested with a more or less random collection of PythonPackage and PythonBundle ECs and counting the number of pip check log lines shows that it is now only called once per EC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Nice-to-have
Development

Successfully merging a pull request may close this issue.

3 participants