Best way to symlink or alias default python?

1,326 views
Skip to first unread message

Frank Fineis

unread,
Jun 29, 2018, 6:09:47 PM6/29/18
to singularity
Hello,

I'm a singularity novice, have mercy! I'm just trying to symlink (or alias) /usr/bin/python3 -> /usr/bin/python. I know I could bootstrap the python:latest Docker image that sets the symlink for me, but I'd rather have a way to do it using another base.

Building the container and running the container like this doesn't work:
Bootstrap: docker
From: ubuntu:latest

%post
    apt-get -y update && apt-get -y install python3

% environment

%runscript
    ln -s python3 /usr/bin/python
    exec python --version

because /usr/bin is read-only.

And then when I try just aliasing:
Bootstrap: docker
From: ubuntu:latest

%post
    apt-get -y update && apt-get -y install python3

% environment

%runscript
    alias python=python3
    exec python --version

I still get error - "exec: python: not found" (the alias wasn't set). When I shell into the container, I can alias python. Don't want to edit the user's .bashrc file or anything.


Any advice? Thanks!
- Frank

v

unread,
Jun 29, 2018, 6:11:26 PM6/29/18
to singu...@lbl.gov
Have you tried doing the symlink in the %post section? Then it should work when you use the runscript.


--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.


--
Vanessa Villamia Sochat
Stanford University '16

Frank Fineis

unread,
Jun 29, 2018, 6:16:02 PM6/29/18
to singularity
I'm a dummy, that was it! Of course that should have worked, because we have the ability to install anything in post. Thanks for your help!

v

unread,
Jun 29, 2018, 6:20:34 PM6/29/18
to singu...@lbl.gov
Of course, anytime! I'm very glad to help :)
Reply all
Reply to author
Forward
0 new messages