Instructions to setup the (local) Python development environment.
- Virtual Environment using
venvfor Standard Python Distribution - Conda Virtual Environment for Anaconda Python Distribution
The venv module provides support for creating lightweight “virtual environments”
with their own site directories,
optionally isolated from system site directories.
Each virtual environment has its own Python binary
(which matches the version of the binary that was used to create this environment)
and can have its own independent set of installed Python packages in
its site directories.
Note: The venv module is part of the Python Standard Library, so no further
installation is required.
The following 3 steps are required to setup a new virtual environment
using venv:
-
Create the environment:
python -m venv </path/to/new/virtual/environment>
-
Activate the environment:
source </path/to/new/virtual/environment/bin/activate>
-
Install the Required Package (using the
requirements.txtfile):pip install -r requirements.txt
-
(Optional) Create new Jupyter notebook Kernel
To avoid re-installing the entire Jupyter stack into the new environment, it is possible to add a new Jupyter Kernel to be used in notebooks with the "default" Jupyter.
To do so, please make sure that the ipykernel package is installed in the new
Python environment:
pip install ipykernel ## this should be the default pip Then, execute the following command:
python -m ipykernel install --user --prefix /path/to/new/virtual/environment --display-name "Python 3 (DL Biomed)"Further information here
If you are using Anaconda Python distribution, it is possible to re-create the
virtual (conda) environment using the export .yml (YAML) file:
conda env create -f dl-biomed.ymlThis will create a new Conda environment named dl-torch with all the
required packages.
To activate the environment:
conda activate dl-biomedTo avoid re-installing the entire Jupyter stack into the new environment, it is possible to add a new Jupyter Kernel to be used in notebooks with the "default" Jupyter.
To do so, please make sure that the ipykernel package is installed in the new
conda environment:
conda install ipykernel Then, still remaining in the new conda environment, execute the following command:
python -m ipykernel install --user --name dl-torch --display-name "Python 3.7 (DL Biomed)"Further information here