Cant find or run installed APP from within the container

530 views
Skip to first unread message

M Noon

unread,
May 8, 2017, 8:05:07 PM5/8/17
to singularity
Hi team, 

I am in the stage of getting familiarized with Singularity and don't know many details about it. I am trying to build a container with MPI libraries and genome aligner (STAR) that could be tested on HPC.
After facing many errors, I succeeded to install both MPI libraries and STAR. I am using Centos7. I am git-cloning both tools within %POST. 
Logically, both programs/executables should be at "/usr/local/bin". Well, I do see mpi and it can be invoked when I am in shell mode. Despite great deal of efforts I couldn't find STAR executable or any folder that was/should have been cloned within the container. I may be missing something very trivial but I can't seem to work it out yet.
Here is my Definition file:


BootStrap: yum

OSVersion: 7

MirrorURL: http://mirror.centos.org/centos-%{OSVERSION}/%{OSVERSION}/os/$basearch/

Include: yum wget

# best to build up container using kickstart mentality.  

# ie, to add more packages to image, 

# re-run bootstrap command again.  

# bootstrap on existing image will build on top of it, not overwriting it/restarting from scratch

# singularity .def file is like kickstart file

# unix commands can be run, but if there is any error, the bootstrap process ends



%setup

   # commands to be executed on host outside container during bootstrap



%post

    # commands to be executed inside container during bootstrap

    yum -y groupinstall "Development Tools"



#    # Clone the OpenMPI GitHub master branch in current directory (on host)

    git clone https://github.com/open-mpi/ompi.git

    cd ompi


    # Build OpenMPI in the working directory

    ./autogen.pl

    ./configure --prefix=/usr/local

    make

    make install

#    

     

    # Instal "zlib1g" to aviod installation error

    yum -y install zlib-devel

     

    # Install STAR -  get STAR source using git

    git clone https://github.com/alexdobin/STAR.git

    cd STAR/source


    echo "Within STAR"

    echo "pwd" 


    # Build STAR

    make STAR


    echo $PATH

    STAR --version


    echo "OUT of Star Dir" 

    STAR --version


    /usr/bin/STAR --help    

 

    # create bind points for storage.  Replace netid as appropriate

    mkdir /extra/mnoon /rsgrps/zarnescu/

    exit 0




 %runscript

   # commands to be executed when the container runs

   echo "Arguments received: $*"

   exec /usr/bin/python "$@"




 %test

   # commands to be executed within container at close of bootstrap process

   python --version

   STAR --version





I also tried to install (git clone) STAR using this alternative method, below:

sudo singularity exec -w centosMPI_star.img

git clone https://github.com/alexdobin/STAR.git

cd STAR/source/

singularity exec ../../centosMPI_star.img make STAR


When I do 

singularity shell centosMPI_star.img


I can't find STAR in any possible directory other than the clonned version on /home/mnoon


Can you please tell me what am I doing wrong? Also, Where should the installed tool/executable be located with the container?


Regards,

M


vanessa s

unread,
May 8, 2017, 9:10:23 PM5/8/17
to singu...@lbl.gov
Hey M,

I think the bug is that you are cloning STAR into the ompi folder, and not the base of the image. Here is what you can try. First, make sure you have development version installed so we are testing from the same version:

git clone -b development https://www.github.com/singularityware/singularity.git
cd singularity
./autogen.sh
./configure --prefix=/usr/local
make
sudo make install

Next, create you image

singularity create --size 4000 star.img

Here is the bootstrap file I used, Singularity, and to bootstrap:

sudo singularity bootstrap star.img Singularity

Note that I cd back to / to install, and then the path that I add is for the distribution specific executable that I want in "bin" (because given the spec that you tried out, the STAR located in ompi /bin looks like this):

Singularity start.img:/ompi/STAR> ls bin/Linux_x86_64/STAR
bin/Linux_x86_64/STAR

Give that a go? Let us know if it works?




--
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+unsubscribe@lbl.gov.



--
Vanessa Villamia Sochat
Stanford University '16

M Noon

unread,
May 9, 2017, 4:11:04 PM5/9/17
to singularity
Hi Vanessa, 

I followed your instructions. I get this error:

g++ -c  -O3 -pipe -Wall -Wextra  bam_cat.c

g++ -o STAR  -O3 -pipe -std=c++11 -Wall -Wextra -fopenmp -D'COMPILATION_TIME_PLACE="Tue May 9 05:03:20 UTC 2017 :/STAR/source"'  SharedMemory.o PackedArray.o SuffixArrayFuns.o STAR.o Parameters.o InOutStreams.o SequenceFuns.o Genome.o Chain.o Stats.o Transcript.o Transcript_alignScore.o ReadAlign.o ReadAlign_storeAligns.o ReadAlign_stitchPieces.o ReadAlign_multMapSelect.o ReadAlign_mapOneRead.o readLoad.o ReadAlignChunk.o ReadAlignChunk_processChunks.o ReadAlignChunk_mapChunk.o OutSJ.o outputSJ.o blocksOverlap.o ThreadControl.o sysRemoveDir.o ReadAlign_maxMappableLength2strands.o binarySearch2.o ReadAlign_outputAlignments.o ReadAlign_outputTranscriptSAM.o ReadAlign_outputTranscriptSJ.o ReadAlign_outputTranscriptCIGARp.o ReadAlign_createExtendWindowsWithAlign.o ReadAlign_assignAlignToWindow.o ReadAlign_oneRead.o ReadAlign_stitchWindowSeeds.o ReadAlign_chimericDetection.o stitchWindowAligns.o extendAlign.o stitchAlignToTranscript.o alignSmithWaterman.o genomeGenerate.o genomeParametersWrite.o genomeScanFastaFiles.o genomeSAindex.o Genome_insertSequences.o insertSeqSA.o funCompareUintAndSuffixes.o sortSuffixesBucket.o funCompareUintAndSuffixesMemcmp.o TimeFunctions.o ErrorWarning.o loadGTF.o streamFuns.o stringSubstituteAll.o Transcriptome.o Transcriptome_quantAlign.o ReadAlign_quantTranscriptome.o Quantifications.o Transcriptome_geneCountsAddAlign.o sjdbLoadFromFiles.o sjdbLoadFromStream.o sjdbPrepare.o sjdbBuildIndex.o sjdbInsertJunctions.o mapThreadsSpawn.o Parameters_openReadsFiles.cpp Parameters_closeReadsFiles.cpp BAMoutput.o BAMfunctions.o ReadAlign_alignBAM.o BAMbinSortByCoordinate.o signalFromBAM.o bamRemoveDuplicates.o BAMbinSortUnmapped.o bam_cat.o GlobalVariables.cpp  -pthread -Lhtslib -Bstatic -lhts -Bdynamic -lz -lrt 

Parameters_openReadsFiles.cpp: In member function 'void Parameters::openReadsFiles()':

Parameters_openReadsFiles.cpp:30:20: warning: variable 'imate' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered]

          for (uint imate=0;imate<readNmates;imate++) {//open readIn files

                    ^

+ mkdir - p /extra/mnoon

mkdir: cannot create directory '/extra/mnoon': No such file or directory

ERROR: Aborting with RETVAL=255

vanessa s

unread,
May 9, 2017, 4:25:14 PM5/9/17
to singu...@lbl.gov
Try removing the mkdir commands first then, I'm not sure I'll be much help for compiling of the random software though.

--
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+unsubscribe@lbl.gov.

M Noon

unread,
May 9, 2017, 4:29:21 PM5/9/17
to singularity
No, It didn't help. I comment out both mkdir commands.

sudo singularity bootstrap starMPI.img starMPI.def 

[sudo] password for mnoon: 

Sanitizing environment

Building from bootstrap definition recipe

Adding base Singularity environment to container

Docker image path: index.docker.io/library/centos:7

Cache folder set to /root/.singularity/docker

Exploding layer: sha256:93857f76ae30d903bbdad13fbf7fad95ce1c0b52b7d5644651e01c6c7a906312.tar.gz

Exploding layer: sha256:9326ff949485e53c2403126b5422ad659cb2176bddbc511461da81c10703a50c.tar.gz

User defined %runscript found! Taking priority.

Running post scriptlet

+ yum -y groupinstall 'Development Tools'

Loaded plugins: fastestmirror, ovl

Loading mirror speeds from cached hostfile

 * base: repo1.sea.innoscale.net

 * extras: centos.firehosted.com

 * updates: mirrors.sonic.net

Maybe run: yum groups mark install (see man yum)

No packages in any requested group available to install or update

+ yum -y install zlib-devel

Loaded plugins: fastestmirror, ovl

Loading mirror speeds from cached hostfile

 * base: repo1.sea.innoscale.net

 * extras: centos.firehosted.com

 * updates: mirrors.sonic.net

Resolving Dependencies

--> Running transaction check

---> Package zlib-devel.x86_64 0:1.2.7-17.el7 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


==============================================================================================================================================================

 Package                                Arch                               Version                                     Repository                        Size

==============================================================================================================================================================

Installing:

 zlib-devel                             x86_64                             1.2.7-17.el7                                base                              50 k


Transaction Summary

==============================================================================================================================================================

Install  1 Package


Total download size: 50 k

Installed size: 132 k

Downloading packages:

warning: /var/cache/yum/x86_64/7/base/packages/zlib-devel-1.2.7-17.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY

Public key for zlib-devel-1.2.7-17.el7.x86_64.rpm is not installed

zlib-devel-1.2.7-17.el7.x86_64.rpm                                                                                                     |  50 kB  00:00:00     

Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Importing GPG key 0xF4A80EB5:

 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <secu...@centos.org>"

 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5

 Package    : centos-release-7-3.1611.el7.centos.x86_64 (@CentOS)

 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  Installing : zlib-devel-1.2.7-17.el7.x86_64                                                                                                             1/1 

  Verifying  : zlib-devel-1.2.7-17.el7.x86_64                                                                                                             1/1 


Installed:

  zlib-devel.x86_64 0:1.2.7-17.el7                                                                                                                            


Complete!

+ cd /

+ git clone https://github.com/alexdobin/STAR.git

fatal: destination path 'STAR' already exists and is not an empty directory.

ERROR: Aborting with RETVAL=255



On Monday, May 8, 2017 at 5:05:07 PM UTC-7, M Noon wrote:

Jason Stover

unread,
May 9, 2017, 4:32:25 PM5/9/17
to singu...@lbl.gov
Hi,

> + mkdir - p /extra/mnoon

Is that command right? It _appears_ as if there's a space between
the '-' and 'p'.

Can you be sure that there isn't a space in the option? You may want
to see if you have a '-' and 'p' directory in the directory you were
building in as well...

-J
> --
> 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 s

unread,
May 9, 2017, 4:42:25 PM5/9/17
to singu...@lbl.gov
Hey M Noon,

It's telling you STAR already exists, which tells me that you are trying to bootstrap again (on a failed image) without re-creating the image. Generally when you try things for a second time, you want to start with a new image, because the git clone is going to fail when it sees the old STAR directory is already there.

Best,

Vanessa

--
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+unsubscribe@lbl.gov.

M Noon

unread,
May 9, 2017, 4:42:55 PM5/9/17
to singularity
I fixed the space and anyway its commented out:: but I don't know how can I go inside the container and check these directories were made or not?? 
I did this,

singularity shell starMPI.img


I cant seem to find , STAR directory on home or path: 

Singularity starMPI.img:~> echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin


Now it terminates at mpi bootstrap step: 

[mnoon@localhost ~]$ sudo singularity bootstrap starMPI.img starMPI.def 

Sanitizing environment

Building from bootstrap definition recipe

Adding base Singularity environment to container

Docker image path: index.docker.io/library/centos:7

Cache folder set to /root/.singularity/docker

Exploding layer: sha256:93857f76ae30d903bbdad13fbf7fad95ce1c0b52b7d5644651e01c6c7a906312.tar.gz

Exploding layer: sha256:9326ff949485e53c2403126b5422ad659cb2176bddbc511461da81c10703a50c.tar.gz

User defined %runscript found! Taking priority.

Running post scriptlet

+ yum -y groupinstall 'Development Tools'

Loaded plugins: fastestmirror, ovl

Loading mirror speeds from cached hostfile

 * base: repo1.sea.innoscale.net

 * extras: centos.firehosted.com

 * updates: mirrors.sonic.net

Maybe run: yum groups mark install (see man yum)

No packages in any requested group available to install or update

+ git clone https://github.com/open-mpi/ompi.git

fatal: destination path 'ompi' already exists and is not an empty directory.

ERROR: Aborting with RETVAL=255 

MPI commands were commented out when I ran earlier thats why it stopped at STAR step (my post above).. With this run only mkdir commands are commented out.

M Noon

unread,
May 9, 2017, 4:44:11 PM5/9/17
to singularity
you might be right. Let me re-run it from scratch and report back!


To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.

M Noon

unread,
May 9, 2017, 5:02:30 PM5/9/17
to singularity
Hi Vanessa, 

I tried from scratch, created a new img and so on: I still get the same error:

g++ -c  -O3 -pipe -Wall -Wextra  bam_cat.c

g++ -o STAR  -O3 -pipe -std=c++11 -Wall -Wextra -fopenmp -D'COMPILATION_TIME_PLACE="Tue May 9 06:18:22 UTC 2017 :/STAR/source"'  SharedMemory.o PackedArray.o SuffixArrayFuns.o STAR.o Parameters.o InOutStreams.o SequenceFuns.o Genome.o Chain.o Stats.o Transcript.o Transcript_alignScore.o ReadAlign.o ReadAlign_storeAligns.o ReadAlign_stitchPieces.o ReadAlign_multMapSelect.o ReadAlign_mapOneRead.o readLoad.o ReadAlignChunk.o ReadAlignChunk_processChunks.o ReadAlignChunk_mapChunk.o OutSJ.o outputSJ.o blocksOverlap.o ThreadControl.o sysRemoveDir.o ReadAlign_maxMappableLength2strands.o binarySearch2.o ReadAlign_outputAlignments.o ReadAlign_outputTranscriptSAM.o ReadAlign_outputTranscriptSJ.o ReadAlign_outputTranscriptCIGARp.o ReadAlign_createExtendWindowsWithAlign.o ReadAlign_assignAlignToWindow.o ReadAlign_oneRead.o ReadAlign_stitchWindowSeeds.o ReadAlign_chimericDetection.o stitchWindowAligns.o extendAlign.o stitchAlignToTranscript.o alignSmithWaterman.o genomeGenerate.o genomeParametersWrite.o genomeScanFastaFiles.o genomeSAindex.o Genome_insertSequences.o insertSeqSA.o funCompareUintAndSuffixes.o sortSuffixesBucket.o funCompareUintAndSuffixesMemcmp.o TimeFunctions.o ErrorWarning.o loadGTF.o streamFuns.o stringSubstituteAll.o Transcriptome.o Transcriptome_quantAlign.o ReadAlign_quantTranscriptome.o Quantifications.o Transcriptome_geneCountsAddAlign.o sjdbLoadFromFiles.o sjdbLoadFromStream.o sjdbPrepare.o sjdbBuildIndex.o sjdbInsertJunctions.o mapThreadsSpawn.o Parameters_openReadsFiles.cpp Parameters_closeReadsFiles.cpp BAMoutput.o BAMfunctions.o ReadAlign_alignBAM.o BAMbinSortByCoordinate.o signalFromBAM.o bamRemoveDuplicates.o BAMbinSortUnmapped.o bam_cat.o GlobalVariables.cpp  -pthread -Lhtslib -Bstatic -lhts -Bdynamic -lz -lrt 

Parameters_openReadsFiles.cpp: In member function 'void Parameters::openReadsFiles()':

Parameters_openReadsFiles.cpp:30:20: warning: variable 'imate' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered]

          for (uint imate=0;imate<readNmates;imate++) {//open readIn files

                    ^

+ mkdir -p /extra/mnoon

+ mkdir -p /rsgrps/zarnescu/

Adding environment to container

Adding deffile section labels to container

Running test scriptlet

+ python --version

Python 2.7.5

+ STAR --version

/.test: line 5: STAR: command not found

ERROR: Aborting with RETVAL=255



On Tuesday, May 9, 2017 at 1:42:25 PM UTC-7, vanessa wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.

vanessa s

unread,
May 9, 2017, 5:05:41 PM5/9/17
to singu...@lbl.gov
I would recommend that you eliminate the test that runs star, have the image build without having that run, then shell into the image, verify the location of the executable, verify that location is on the path, try the test manually, and only then try the whole thing from start to finish. There is no significant error here other than a path one, and that's pretty easy to figure out.

To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.

Jason Stover

unread,
May 9, 2017, 5:16:45 PM5/9/17
to singu...@lbl.gov
Hi,

> + STAR --version
> /.test: line 5: STAR: command not found

What is your $PATH value, and is the location of the STAR binary included?

-J

M Noon

unread,
May 9, 2017, 6:11:42 PM5/9/17
to singularity
Hi Jason, 

its on my path:

echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin/STAR/bin/Linux_x86_64



The problem is that I cant find it here "/bin/STAR/" or any other directory in the path.. I dont understand this behavior.. this is could be something very very trivial that I am missing.


Thanks,

M

vanessa s

unread,
May 9, 2017, 6:17:31 PM5/9/17
to singu...@lbl.gov
The executable isn't in /bin... why do you expect it to be found there?

Best,

Vanessa

Jason Stover

unread,
May 9, 2017, 6:21:35 PM5/9/17
to singu...@lbl.gov
Hi,

Has your definition file changed since you originally posted it? In
the definition file you're doing ...

cd ompi
# Build OpenMPI in the working directory
[ ... ]
# Install STAR - get STAR source using git
git clone https://github.com/alexdobin/STAR.git
cd STAR/source

So... from my reading of that, you're checking the STAR source out,
into the ompi clone, as you're never changing from the ompi
directory....

I'm guessing that path is: /root/ompi/STAR

You are also not doing a "make install" after STAR is built... so
the STAR binary is probably just sitting in the STAR source
directory...

-J

M Noon

unread,
May 9, 2017, 6:22:34 PM5/9/17
to singularity

This may sound silly but  where should I find it? I can see under /usr/local/bin mpi libraries are installed but nowhere can I find any STAR folder or any binary? not even on home? I am cloning a git repo, I cant find it at all..

On Monday, May 8, 2017 at 5:05:07 PM UTC-7, M Noon wrote:

Jason Stover

unread,
May 9, 2017, 6:27:00 PM5/9/17
to singu...@lbl.gov
Hi,

Vanessa could totally answer this better than I... but I think it
depends on what Singularity does when it runs those...

So, I'm going to _guess_ that there's either a: /ompi , or
/root/ompi directory. And within that, you will probably find the STAR
directory... Poke around a bit in a shell if you can get into it.

-J

M Noon

unread,
May 9, 2017, 6:27:38 PM5/9/17
to singularity
Hi Jason, 

Yes, I am using a new definition files shared by Vanessa.. ON STAR git page these are the instructions for installation.. There no 'make install' command in the instrucions.. it works when I install it locally outside the container.
# Alternatively, get STAR source using git
git clone https://github.com/alexdobin/STAR.git
cd STAR/source

# Build STAR
make STAR


 here it is:

Bootstrap:docker
From: centos:7
%labels
CREATOR vso...@stanford.edu
%environment
PATH=$PATH/STAR/bin/Linux_x86_64
%post
# commands to be executed inside container during bootstrap
yum -y groupinstall "Development Tools"
# Install OpenMPI
./autogen.pl
./configure --prefix=/usr/local
make
make install
# Instal "zlib1g" to aviod installation error
yum -y install zlib-devel
# Install Star
cd /
git clone https://github.com/alexdobin/STAR.git
cd STAR/source
make STAR
mkdir - p /extra/mnoon
mkdir -p /rsgrps/zarnescu/
%runscript
echo "Arguments received: $*"
exec /usr/bin/python "$@"
%test
python --version
STAR --version

vanessa s

unread,
May 9, 2017, 6:31:45 PM5/9/17
to singu...@lbl.gov
I tested this before and the star executable is in the folder that I added to the path (under the environment). please try running without the test, and then verify that it is there.

Best,

Vanessa

Jason Stover

unread,
May 9, 2017, 6:35:53 PM5/9/17
to singu...@lbl.gov
Hi,

  > PATH=$PATH/STAR/bin/Linux_x86_64

That is incorrect. It should be: PATH=${PATH}:/STAR/bin/Linux_x86_64

There's a ':' missing... The '{PATH}' is just to specify more.

-J


To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.

vanessa s

unread,
May 9, 2017, 6:50:29 PM5/9/17
to singu...@lbl.gov
haha, yep that's it! My bad! I really shouldn't program without contact lenses in. Good catch @jason! :_)

M Noon

unread,
May 9, 2017, 7:54:00 PM5/9/17
to singularity
Hi Jason, 

Thanks for catching this, I figured it out because of the missing colon, it got located as "/STAR/bin/Linux_x86_64".. It is runs now!

Thank you, Vanessa for helping me with this.

-M
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.

Reply all
Reply to author
Forward
0 new messages