Python environment¶
It is always recommended to install BacterialTyper and all its dependencies and modules
under a python environment.
Take into account that you might need to have installed several developer libraries in your system. See section System requirements for details.
By executing the env/create_python_environment.sh script, it creates an environment, installs
all python requirements and activates it for later usage.
You only have to create the environment once and you can populate with additional modules, see details in Install modules.
Make sure to deactivate the environment after finishing the exection of `BacterialTyper
or activate it before running it, following the instructions in Deactivate environment
or Activate environment sections respectively.
Create environment¶
To do so, run env/create_python_environment.sh, which is shown below:
#!/usr/bin/env bash
echo ""
echo ""
echo "##### Create a virtual environment for BacterialTyper ####"
echo ""
export PYTHONPATH=""
echo "python3 -m venv env/BacterialTyper"
python3 -m venv env/BacterialTyper
echo "Done..."
echo ""
echo "#### Activate virtual environment ####"
echo "source env/BacterialTyper/bin/activate"
source env/BacterialTyper/bin/activate
echo "Done..."
echo ""
## upgrade pip
echo "#### Upgrade pip package installer ####"
echo "pip install -I --isolated --upgrade pip"
pip install -I --isolated --upgrade pip
echo "Done...."
echo ""
# install BacterialTyper requirements
echo "#### Install pip package requirements ####"
echo "pip install -I --isolated --default-timeout=500 -r BacterialTyper/config/python/min_python_requirements.txt"
pip install -I --isolated --default-timeout=500 -r BacterialTyper/config/python/min_python_requirements.txt
echo "Done...."
echo ""
echo "Exit...."
echo ""
Execute the file from the main directory as:
source env/create_python_environment.sh
Within this create environment script, there is a command to install all python
requirements for BacterialTyper:
pip install -r BacterialTyper/config/python_requirements.txt
Activate environemt¶
Before executing any BacterialTyper module or script, it is convenient
to activate the environment.
To do so, run env/activate_environment.sh, which is shown below:
#!/usr/bin/env bash
echo ""
echo ""
echo "##### Activate the virtual environment for BacterialTyper ####"
echo ""
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
echo "source $DIR/BacterialTyper/bin/activate"
source $DIR/BacterialTyper/bin/activate
echo "Done..."
echo ""
echo "Exit...."
echo ""
Execute the file from the directory BacterialTyper/ as:
source env/activate_environment.sh
Deactivate environemt¶
After finished the execution of any BacterialTyper module or script, it is convenient
to deactivate the environment. You can just close the terminal but it would be more appopiate
to conveniently deactivate the environment first.
To do so, execute the following command:
deactivate
Install modules¶
Once the BacterialTyper environment is created, install using pip BacterialTyper or any
additional modules.
e.g.: Install BacterialTyper
python -m pip install BacterialTyper
e.g.: install a list of requirements
pip install -r BacterialTyper/config/python_requirements.txt
Attention
Installing BacterialTyper using pip installs
all the python requirements. For additional third-party software and
software required for BacterialTyper to work you will need to run the
config module.