-
Notifications
You must be signed in to change notification settings - Fork 3
Create a virtual environment
When working with Python we should always work in so-called virtual environments, in which our project specific dependencies are satisfied without polluting or breaking other projects' dependencies and to avoid breaking all our dependencies in case of an update of our Python distribution.
If you are not familiar with Python virtual environments you can get the motivation and an insight into the mechanism in the official docs. On this wiki page we provide links and examples to create a virtual environment both with Mini-/Anaconda or alternatively with pip.
For easy environment creation we provide an environment.yml file in the root of our repository. With this file you can create a virtual environment on your local machine as described in the official docs of Anaconda.
It boils down to navigating to your repository's folder and executing
$ conda env create -f environment.ymlAfterwards you can work with your environment on the command line by issuing
$ conda activate Met4FoF_CodeFor easy environment creation with Python built-in tools we provide a requirements.txt file in the root of our repository. With this file you can create a virtual environment on your local machine as described in the official docs of Python itself.
It boils down to navigating to any folder, in which you want to create a subfolder with the name Met4FoF_Code for the virtual environment and executing
$ python3 -m venv Met4FoF_CodeThen activate the fresh environment as described in the official docs,
$ source Met4FoF_Code/bin/activatewhich will most likely display the environment name in front of the shell and install the project's dependencies with
(Met4FoF_Code) $ pip install -r /PATH/TO/YOUR/CLONE/requirements.txt