0

I wish to run a Python script in a singularity container.

In particular, I have attempted writing the following in the shell script

singularity shell <name.sif>
python3 <python-script.py>

I expected the python script to be run within the singularity container, but it outputs a segmentation fault (which occurs when I run the script on its own, outside the singularity container). However, when I try to do this manually by executing the commands individually, it works well. I would like to know how to shell script this properly. Thank you!

1 Answer 1

1

You're starting an interactive Singularity shell. The command after that will be executed when you exit the shell.

Use singularity exec to execute a command inside the container.

singularity exec <name.sif> python3 <python-script.py>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.