Skip to content

Virtual Environmnet

Alex edited this page Jun 18, 2024 · 4 revisions

Virtual environment for this repository and how to use it

Using a virtual environment helps us to control all packages and their versions.

Creating a virtual environment

We recommend the Poetry package, since it is a great tool for dependency management.

Using Poetry

  1. (optional) create virtual environments inside the project folder

    poetry config virtualenvs.create true --local
    poetry config virtualenvs.in-project true --local

    --local can be ignored, if you wish to have these settings global.

  2. Install packages and create virtual environment

    poetry install --no-root
  3. Run the code via a single line of code

    poetry run python main.py

    or entering the virtual environment via

    poetry shell

    and then run the code inside the virtual environment via

    python main.py

Using venv

  1. creating virtual environment

    python -m venv .venv
  2. activate

    source .venv/bin/activate
  3. install packages

    python -m pip install requirements.txt
  4. run

    python main.py
  5. If no longer needed deactivate it

    deactivate

Packages

Here we want to provide an overview of the packages we use:

poetry show

provides a list of all packages