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

Usage of environment-modules in containers #6296

Closed
xfong opened this issue Nov 12, 2021 · 7 comments · Fixed by #6305
Closed

Usage of environment-modules in containers #6296

xfong opened this issue Nov 12, 2021 · 7 comments · Fixed by #6305
Assignees
Milestone

Comments

@xfong
Copy link

xfong commented Nov 12, 2021

Version of Singularity:

What version of Singularity are you using? 3.7.4 and 3.8.*

Container is built with the 90-environment.sh to set up the environment-modules environment ( ". /etc/profile.d/modules.sh") and additional environment set up using "module load".

Expected behavior

All environment variables in the modules (e.g., PATH, CPATH, INCLUDE_PATH, LD_LIBRARY_PATH, PYTHONPATH, LOADEDMODULES, etc.) should be correctly defined and imported.

Actual behavior

The correct behavior is observed in 3.7.4 but is broken after 3.8.0.
PYTHONPATH is not correctly updated. Running "module list" in the updated environment shows an error that it is not able to locate certain variables in environment-modules. The container is the same for running in both versions of singularity.

Steps to reproduce this behavior

How can others reproduce this issue/problem?

  • Build a container based on Ubuntu with environment-modules and has a module that tries to set up PYTHONPATH
  • For the build, include lines in the %environment section to load the module upon entering the container (e.g., . /etc/profile.d/modules.sh && module load testModule)
  • Launch an interactive shell in the container and run ". /etc/profile.d/modules.sh && module list"

What OS/distro are you running

Ubuntu 18.04

How did you install Singularity

Installed from source. The host machine is running Ubuntu 20.04

@DrDaveD
Copy link
Collaborator

DrDaveD commented Nov 12, 2021

Please provide a full container definition file to reproduce the problem. For instance I don't know where the "module" command is coming from.

@xfong
Copy link
Author

xfong commented Nov 16, 2021

The container definition file is "sample_test.txt". The "test" file that is called in the %files section is "test.txt".
The expected behavior after the container is created is that "singularity shell -e" into the container should result in the PYTHONPATH environment variable being set by the %environment section in the definition file.

sample_test.txt
test.txt

@DrDaveD
Copy link
Collaborator

DrDaveD commented Nov 16, 2021

Intermediate status update: @cclerget told me by slack that he found a workaround, by putting export PYTHONPATH= before the invocation of . /etc/profile.d/modules.sh in the container definition. I confirmed that in a test. He also found that the cause of the problem is a regression in a dependent package, mvdan.cc/sh, because downgrading to version 3.2.4 of that package makes the problem go away.

@cclerget
Copy link
Collaborator

Fix mvdan/sh#759 on its way

@DrDaveD
Copy link
Collaborator

DrDaveD commented Nov 17, 2021

Is this a significant enough problem for a 3.8.5 release or can it wait to 3.9?

@xfong
Copy link
Author

xfong commented Nov 17, 2021 via email

@DrDaveD
Copy link
Collaborator

DrDaveD commented Nov 19, 2021

There's no official plan yet for 3.9 but my personal guess is that it will be in a couple of months.

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 a pull request may close this issue.

3 participants