Skip to content

Conversation

Flamefire
Copy link
Contributor

@Flamefire Flamefire commented Sep 2, 2025

(created using eb --new-pr)

Without this the sanity check might fail due to user modules or required venv:

== FAILED: Installation ended unsuccessfully: `python -m pip check` failed:
ERROR: Could not find an activated virtualenv (required).

@Flamefire
Copy link
Contributor Author

Test report by @Flamefire

Overview of tested easyconfigs (in order)

  • SUCCESS Python-3.11.3-GCCcore-12.3.0.eb

Build succeeded for 1 out of 1 (1 easyconfigs in total)
i8024 - Linux Rocky Linux 8.9 (Green Obsidian), x86_64, AMD EPYC 7352 24-Core Processor (zen2), 8 x NVIDIA NVIDIA A100-SXM4-40GB, 555.42.06, Python 3.9.18
See https://gist.github.com/Flamefire/55c83c3d0cb5c13216a7b25df3f4d97c for a full test report.

@Crivella
Copy link
Contributor

Crivella commented Sep 2, 2025

I guess this would be relevant for any version of pip < 24.2

Another interesting aspect that might be work considering for Python module-wise would be to set PYTHONNOUSERSITE=1 in general.
While reproducing this i was wondering why python -m pip -V was reporting my user installed pip even if i had loaded Python from easybuild

This lead me to think that it is possible that the pip check ran right now by easybuild might be affected by what is installed in $HOME/.local/... so another possible benefit of this change would be to avoid this

@Flamefire
Copy link
Contributor Author

I guess this would be relevant for any version of pip < 24.2

Yes. Nice that they fixed that part.

Another interesting aspect that might be work considering for Python module-wise would be to set PYTHONNOUSERSITE=1 in general.

Where? In framework or so? Or in the module file?

This lead me to think that it is possible that the pip check ran right now by easybuild might be affected by what is installed in $HOME/.local/... so another possible benefit of this change would be to avoid this

Depends. For PythonPackage/Bundle we already set the env var. Only here (and in LAMMPS which I just found) we don't

@Crivella
Copy link
Contributor

Crivella commented Sep 2, 2025

Where? In framework or so? Or in the module file?

In the module file from either the Python or PythonBundle easyblocks (or both).
Should give it more thought if it could break something, but i do not think there is a realistic case where we would want to pick up local user installs together with our installs (unless the user is loading a virtualenv on top of it that would not bbe affected by it)

@Flamefire
Copy link
Contributor Author

In the module file from either the Python or PythonBundle easyblocks (or both).

Python would be enough, doesn't need to be in every module. We currently have a hook adding PIP_REQUIRE_VIRTUALENV=1 to the Python module as we had too many instances of users/admins installing stuff to the Python module by accident.

That could be a standard setting as it doesn't make sense to use pip outside a virtualenv with the Python module, does it? Maybe pip install --prefix might be used by users though.

Should give it more thought if it could break something, but i do not think there is a realistic case where we would want to pick up local user installs together with our install

Not sure. Outside of virtualenvs the users regular pip install installs to his $HOME which is then always available when loading the module. Some sites might allow/suggest that.

It would certainly be a breaking change but I wouldn't mind. It does avoid a class of issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants