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

ignore user-installed packages when running python in sanitycheck #21362

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

Flamefire
Copy link
Contributor

Running a plain python -c ... or python -m ... in ECs not using PythonPackage might pick up packages installed in $HOME/.local/lib/python*.
As we haven't set $PYTHONNOUSERSITE in those ECs/EasyBlocks we need to pass -s to python to the same effect.
This avoids unexpected failures or success caused by that user environment.

@SebastianAchilles
Copy link
Member

@boegelbot please test @ jsc-zen3
EB_ARGS="--sanity-check-only --filter-ecs=OptiX-7.2.0.eb,2019a,2020a,2020b,2021a,2021b,2022a,2022b,8.2.0,8.3.0,9.3.0,10.2.0,10.3.0"

@SebastianAchilles
Copy link
Member

@boegelbot please test @ generoso
EB_ARGS="--sanity-check-only --filter-ecs=OptiX-7.2.0.eb,Gurobi-8.1.1.eb,Optax-0.1.7-foss-2022a-CUDA-11.7.0.eb,OR-Tools-7.1-foss-2019a-Python-3.7.2.eb,ParaView-5.11.1-foss-2022b-CUDA-12.2.0.eb"

@boegelbot
Copy link
Collaborator

@SebastianAchilles: Request for testing this PR well received on login1

PR test command 'EB_PR=21362 EB_ARGS="--sanity-check-only --filter-ecs=OptiX-7.2.0.eb,Gurobi-8.1.1.eb,Optax-0.1.7-foss-2022a-CUDA-11.7.0.eb,OR-Tools-7.1-foss-2019a-Python-3.7.2.eb,ParaView-5.11.1-foss-2022b-CUDA-12.2.0.eb" EB_CONTAINER= EB_REPO=easybuild-easyconfigs /opt/software/slurm/bin/sbatch --job-name test_PR_21362 --ntasks=4 ~/boegelbot/eb_from_pr_upload_generoso.sh' executed!

  • exit code: 0
  • output:
Submitted batch job 14230

Test results coming soon (I hope)...

- notification for comment with ID 2340745407 processed

Message to humans: this is just bookkeeping information for me,
it is of no use to you (unless you think I have a bug, which I don't).

@boegelbot
Copy link
Collaborator

Test report by @boegelbot
FAILED
Build succeeded for 36 out of 44 (42 easyconfigs in total)
cns1 - Linux Rocky Linux 8.9, x86_64, Intel(R) Xeon(R) CPU E5-2667 v3 @ 3.20GHz (haswell), Python 3.6.8
See https://gist.github.com/boegelbot/3691c9de94b5a64eff637e2ff22bcae1 for a full test report.

@SebastianAchilles
Copy link
Member

@boegelbot please test @ jsc-zen3
EB_ARGS="--sanity-check-only OTF2-3.0.3-GCCcore-12.3.0.eb OTF2-3.0.3-GCCcore-12.2.0.eb OTF2-3.0-GCCcore-11.3.0.eb OTF2-3.0.2-GCCcore-11.3.0.eb OTF2-3.0.3-GCCcore-13.2.0.eb longestrunsubsequence-1.0.1-GCCcore-10.3.0.eb LIBSVM-Python-3.30-foss-2022a.eb PICI-LIGGGHTS-3.8.1-foss-2022a.eb OTF2-3.0.2-GCCcore-11.2.0.eb scikit-bio-0.6.0-foss-2023a.eb cfgrib-0.9.14.0-foss-2023a.eb librosa-0.10.1-foss-2023a.eb ParaView-5.9.1-foss-2021a-mpi.eb ParaView-5.10.1-foss-2022a-mpi.eb ParaView-5.11.1-foss-2022a-mpi.eb ParaView-5.11.2-foss-2023a.eb CLANS-2.0.8-foss-2023a.eb pyMBE-0.8.0-foss-2023b.eb Gubbins-3.3.5-foss-2022b.eb ParaView-5.11.1-foss-2022b.eb ParaView-5.12.0-foss-2023b-Qt5.eb ParaView-5.12.0-foss-2023b.eb ParaView-5.9.1-foss-2021b-mpi.eb scCODA-0.1.9-foss-2023a.eb"

@boegelbot
Copy link
Collaborator

@SebastianAchilles: Request for testing this PR well received on jsczen3l1.int.jsc-zen3.fz-juelich.de

PR test command 'if [[ develop != 'develop' ]]; then EB_BRANCH=develop ./easybuild_develop.sh 2> /dev/null 1>&2; EB_PREFIX=/home/boegelbot/easybuild/develop source init_env_easybuild_develop.sh; fi; EB_PR=21362 EB_ARGS="--sanity-check-only OTF2-3.0.3-GCCcore-12.3.0.eb OTF2-3.0.3-GCCcore-12.2.0.eb OTF2-3.0-GCCcore-11.3.0.eb OTF2-3.0.2-GCCcore-11.3.0.eb OTF2-3.0.3-GCCcore-13.2.0.eb longestrunsubsequence-1.0.1-GCCcore-10.3.0.eb LIBSVM-Python-3.30-foss-2022a.eb PICI-LIGGGHTS-3.8.1-foss-2022a.eb OTF2-3.0.2-GCCcore-11.2.0.eb scikit-bio-0.6.0-foss-2023a.eb cfgrib-0.9.14.0-foss-2023a.eb librosa-0.10.1-foss-2023a.eb ParaView-5.9.1-foss-2021a-mpi.eb ParaView-5.10.1-foss-2022a-mpi.eb ParaView-5.11.1-foss-2022a-mpi.eb ParaView-5.11.2-foss-2023a.eb CLANS-2.0.8-foss-2023a.eb pyMBE-0.8.0-foss-2023b.eb Gubbins-3.3.5-foss-2022b.eb ParaView-5.11.1-foss-2022b.eb ParaView-5.12.0-foss-2023b-Qt5.eb ParaView-5.12.0-foss-2023b.eb ParaView-5.9.1-foss-2021b-mpi.eb scCODA-0.1.9-foss-2023a.eb" EB_CONTAINER= EB_REPO=easybuild-easyconfigs EB_BRANCH=develop /opt/software/slurm/bin/sbatch --job-name test_PR_21362 --ntasks=8 ~/boegelbot/eb_from_pr_upload_jsc-zen3.sh' executed!

  • exit code: 0
  • output:
Submitted batch job 4845

Test results coming soon (I hope)...

- notification for comment with ID 2342989130 processed

Message to humans: this is just bookkeeping information for me,
it is of no use to you (unless you think I have a bug, which I don't).

@boegelbot
Copy link
Collaborator

Test report by @boegelbot
FAILED
Build succeeded for 23 out of 24 (24 easyconfigs in total)
jsczen3c1.int.jsc-zen3.fz-juelich.de - Linux Rocky Linux 9.4, x86_64, AMD EPYC-Milan Processor (zen3), Python 3.9.18
See https://gist.github.com/boegelbot/20bc638a19f7288e6e2d332a5cdc1c8d for a full test report.

@boegel
Copy link
Member

boegel commented Sep 11, 2024

@boegelbot please test @ generoso
EB_ARGS="LIBSVM-Python-3.30-foss-2022a.eb"

@boegel
Copy link
Member

boegel commented Sep 11, 2024

@Flamefire We should also add a check in the easyconfigs test suite to avoid that python -c without -s gets introduced again, or we can keep playing whack-a-mole for this going forward...

Are you up for looking into that in this PR?

@boegel boegel modified the milestones: 4.9.3, release after 4.9.3 Sep 11, 2024
@boegelbot
Copy link
Collaborator

@boegel: Request for testing this PR well received on login1

PR test command 'EB_PR=21362 EB_ARGS="LIBSVM-Python-3.30-foss-2022a.eb" EB_CONTAINER= EB_REPO=easybuild-easyconfigs /opt/software/slurm/bin/sbatch --job-name test_PR_21362 --ntasks=4 ~/boegelbot/eb_from_pr_upload_generoso.sh' executed!

  • exit code: 0
  • output:
Submitted batch job 14246

Test results coming soon (I hope)...

- notification for comment with ID 2344275155 processed

Message to humans: this is just bookkeeping information for me,
it is of no use to you (unless you think I have a bug, which I don't).

@boegelbot
Copy link
Collaborator

Test report by @boegelbot
SUCCESS
Build succeeded for 1 out of 1 (1 easyconfigs in total)
cns3 - Linux Rocky Linux 8.9, x86_64, Intel(R) Xeon(R) CPU E5-2667 v3 @ 3.20GHz (haswell), Python 3.6.8
See https://gist.github.com/boegelbot/6614f3253fdeef9380ed3e8eda832196 for a full test report.

Running a plain `python -c ...` or `python -m ...` in ECs not using
`PythonPackage` might pick up packages installed in
`$HOME/.local/lib/python*`.
As we haven't set `$PYTHONNOUSERSITE` in those ECs/EasyBlocks we need to
pass `-s` to `python` to the same effect.
This avoids unexpected failures or success caused by that user environment.
@Flamefire
Copy link
Contributor Author

@Flamefire We should also add a check in the easyconfigs test suite to avoid that python -c without -s gets introduced again, or we can keep playing whack-a-mole for this going forward...

Are you up for looking into that in this PR?

Done, although it is not trivial.

@Flamefire
Copy link
Contributor Author

Flamefire commented Sep 23, 2024

Test report by @Flamefire
FAILED
Build succeeded for 39 out of 43 (43 easyconfigs in total)
i7010 - Linux Rocky Linux 8.9 (Green Obsidian), x86_64, AMD EPYC 7702 64-Core Processor (zen2), Python 3.8.17
See https://gist.github.com/Flamefire/41b812d34923f1cc119ad10977090782 for a full test report.

Failures:

# Make sure the user packages in $HOME/.local/lib/python*/ are ignored when running python commands
# For the EasyBlocks above this is handled automatically by setting $PYTHONNOUSERSITE
# Detect any code or module invocation (-m or -c), `python cc` and `python <filepath>`
python_re = re.compile(r'\bpython (-c|-m|cc|[^ ]*\w+.py) ')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested in EasyBuild conf call:

  • just define $PYTHONNOUSERSITE globally in framework;
  • or introduce a template to run python -c -s commands

Copy link
Contributor Author

@Flamefire Flamefire Sep 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the other 2 variables too? Do we have anything like that already, if so where?

Enforcing that template might be tricky. And we can only have it python -s as we need -m, -c, cc and maybe others which makes using the template more typing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What other two variables do you mean exactly?

We have similar stuff, though not for Python yet, see for example setting of $CUDA_CACHE_DISABLE in easyblock.py

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also $PIP_DISABLE_PIP_VERSION_CHECK and $XDG_CACHE_HOME and later $PIP_REQUIRE_VIRTUALENV, see https://github.com/easybuilders/easybuild-easyblocks/pull/3460/files#diff-254aa63061aafed567ef5cc25be7b809dc9a1e4e41b5de85c2e607ea95cf33cbR123

$CUDA_CACHE_DISABLE is set in the prepare_step which IIRC isn't run for sanity-check-only. I think we can set $PYTHONNOUSERSITE and $PIP_DISABLE_PIP_VERSION_CHECK without issues but I'm not sure where. $PIP_REQUIRE_VIRTUALENV would need to be set globally and after loading modules (including fake modules)

@Flamefire
Copy link
Contributor Author

Flamefire commented Oct 1, 2024

Test report by @Flamefire
SUCCESS / FAILED
Build succeeded for 42 out of 43 (43 easyconfigs in total)
i7123 - Linux Rocky Linux 8.9 (Green Obsidian), x86_64, AMD EPYC 7702 64-Core Processor (zen2), Python 3.8.17
See https://gist.github.com/Flamefire/87e95cc3897f06afb4eaf6b6487e30a5 for a full test report.

OR-Tools fails due to license issues, so OK

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.

4 participants