Milodupipo
Milodupipo

Reputation: 61

Bind and run a Python module with singularity from a remote directory

I need to run a personnal Python module from a singularity container. I usually run it with the following command :

singularity run ./Image/myimage.sif -m mymodule.start

However it's only work if I am in the same folder as 'mymodule'.

Now, I need to run this same module from a remote directory. I therefore bind my 'mymodule' directory :

singularity run --bind ~/Projects/MyModule/:/mnt ./Image/myimage.sif -m mymodule.start

Unfortunately it is binded in the /mnt directory, which means my module cannot be found. The error is

/usr/bin/python3: No module named mymodule.start

How could I make mymodule findable ?

Upvotes: 1

Views: 171

Answers (2)

Milodupipo
Milodupipo

Reputation: 61

I finally used the follwing command :

singularity run --bind ~/Projects/MyModule/:$HOME ./Image/myimage.sif -m mymodule.start

to mount my project in the home directory and have access to it without changing the directory.

Upvotes: 0

darked89
darked89

Reputation: 529

Depends how the paths are specified in module.start but this should work with apptainer:

APPTAINERENV_PREPEND_PATH=$HOME/Projects/MyModule/ --bind ~/Projects/MyModule/:/mnt ./Image/myimage.sif -m mymodule.start

Upvotes: 0

Related Questions