Linux Software Installation – Exercises 1
Part 1. Setup Conda
1.1 Login to the BioHPC machine and download the installer
Login (ssh) to the machine that you are assigned for this workshop (assigned machines: https://biohpc.cornell.edu/ww/machines.aspx?i=128). Prepare the working directory, and download the latest version of Miniconda/python3 installer into the working directory.
mkdir /workdir/$USER
cd /workdir/$USER
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
1.2 Run the installer
chmod u+x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh
The “chmod u+x” command makes the file executable.
During the installation, you will be asked for multiple questions:
1) “Please, press ENTER to continue”: press “ENTER” key;
2) “More”: keep pressing “SPACE” key until you reach next question;
3) “Do you accept the license terms?”: enter “yes”
4) “Miniconda3 will now be installed into this location … ”: press “ENTER” key and accept the default “/home/xxxxx/miniconda3”.
5) “Do you wish the installer to initialize Miniconda3” : Press ENTER to accept the default “no”;
1.3 Miniconda is ready.
Part 2. Install and run a simple software in Conda
2.1 Install bwa in Conda
source $HOME/miniconda3/bin/activate
conda install -c bioconda bwa
2.2 Run bwa in Conda
Next time you login, to run bwa that you installed:
source $HOME/miniconda3/bin/activate
bwa
which bwa
Part 3. Work with Conda environment
3.1 Create a virtual environment and give it a name “pysam”, install pysam the virtual environment
conda create -c bioconda -n pysam pysam
3.2 Start the pysam environment, and run python
conda activate pysam
which python
python -V
which pip
“which python” “which pip”would tell you which python and pip you are using .
3.3 Install other python modules in this environment
pip install numpy
3.4 End the environment
conda deactivate
3.5. Now you installed pysam and numpy in miniconda3 in the home directory. Next time you need to use it in a new session, run these commands
source $HOME/miniconda3/bin/activate
conda activate pysam
# after the work is done
conda deactivate
Part 4. Create a Python2.7 environment in Miniconda3
conda create -n myNewPipeline python=2.7
conda activate myNewPipeline
which python
python -V ##use capital V
conda deactivate
Note in the first command there is no package name. This step would create an empty python2.7 environment, within which you can use pip to install other python modules.