Skip to content

Latest commit

 

History

History
71 lines (54 loc) · 1.95 KB

installation.md

File metadata and controls

71 lines (54 loc) · 1.95 KB

Installation

{% include-markdown "../../README.md" start="" end="" %}

Installation

First, you need to make sure you have Python installed (at least version 3.11):

!!! Note inline end

These instructions assume you are using a [POSIX compatible
`sh`](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html)
shell.
$ python3 --version
Python 3.11.4

If that command doesn't print a version newer than 3.11.0, you'll need to download and install Python first.

To install Frequenz Channels, you probably want to create a new virtual environment first:

mkdir my-channels-project
cd my-channels-project
python3 -m venv .venv
. .venv/bin/activate

!!! Tip

Using [`direnv`](https://direnv.net/) can greatly simplify this process as
it automates the creation, activation, and deactivation of the virtual
environment. The first time you enable `direnv`, the virtual environment
will be created, and each time you enter or leave a subdirectory, it will be
activated and deactivated, respectively.

```sh
sudo apt install direnv # if you use Debian/Ubuntu
mkdir my-channels-project
cd my-channels-project
echo "layout python python3" > .envrc
direnv allow
```

This will create the virtual environment and activate it automatically for you.

Now you can install Frequenz Channels by using pip (if you don't have pip installed you can follow the official instructions):

python3 -m pip install frequenz-channels

To verify that the installation worked, you can invoke the Python interpreter and import the frequenz.channels module:

$ python3
Python 3.11.4 (main, Jun  7 2023, 10:13:09) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import frequenz.channels
>>>