Scheduled maintenance on Saturday, 27 September 2025, from 07:00 AM to 4:00 PM GMT (09:00 AM to 6:00 PM CEST) - some services may be unavailable -

Skip to content
Snippets Groups Projects
Select Git revision
  • 26a7a4677feed72c94205bc3da378b192d3d5288
  • master default
  • feat/320-cttc-ietf-simap-basic-support-with-kafka-yang-push
  • cnit_tapi
  • feat/292-cttc-implement-integration-test-for-ryu-openflow
  • feat/314-tid-new-service-for-ipowdm-configuration-fron-orchestrator-to-ipowdm-controller
  • feat/327-tid-new-service-to-ipowdm-controller-to-manage-transceivers-configuration-on-external-agent
  • cnit-p2mp-premerge
  • feat/325-tid-nbi-e2e-to-manage-e2e-path-computation
  • feat/307-update-python-version-service
  • feat/326-tid-external-management-of-devices-telemetry-nbi
  • openroadm-flex-grid
  • feat/310-cttc-implement-nbi-connector-to-interface-with-osm-client
  • develop protected
  • feat/324-tid-nbi-ietf_l3vpn-deploy-fail
  • feat/321-add-support-for-gnmi-configuration-via-proto
  • feat/322-add-read-support-for-ipinfusion-devices-via-netconf
  • feat/323-add-support-for-restconf-protocol-in-devices
  • feat/policy-refactor
  • feat/192-cttc-implement-telemetry-backend-collector-gnmi-openconfig
  • feat/307-update-python-version
  • feat/telemetry-collector-int
  • v5.0.0 protected
  • v4.0.0 protected
  • demo-dpiab-eucnc2024
  • v3.0.0 protected
  • v2.1.0 protected
  • v2.0.0 protected
  • v1.0.0 protected
29 results

2-1-python-environment.md

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.

    2.1. Configure Python Environment

    This section describes how to configure the Python environment to run experiments and develop code for the ETSI TeraFlowSDN controller. In particular, we use PyEnv to install the appropriate version of Python and manage the virtual environments.

    2.1.1. Upgrade the Ubuntu distribution

    Skip this step if you already did it during the creation of the VM.

    sudo apt-get update -y
    sudo apt-get dist-upgrade -y

    2.1.2. Install PyEnv dependencies in the VM

    sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget \
        curl llvm git libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

    2.1.3. Install PyEnv

    curl https://pyenv.run | bash
    # When finished, edit ~/.bash_profile // ~/.profile // ~/.bashrc as the installer proposes.
    # In general, it means to append the following lines to ~/.bashrc:
    export PYENV_ROOT="$HOME/.pyenv"
    command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
    eval "$(pyenv init -)"
    eval "$(pyenv virtualenv-init -)"

    In case .bashrc is not linked properly to your profile, you may need to append the following line into your local .profile file:

    # Open ~/.profile and append this line:
    +source "$HOME"/.bashrc

    2.1.4. Restart the VM

    Restart the VM for all the changes to take effect.

    sudo reboot

    2.1.5. Install Python 3.9 over PyEnv

    pyenv install 3.9.13
        # This command might take some minutes depending on your Internet connection speed and the performance of your VM.

    2.1.6. Create the Virtual Environment for TeraFlowSDN

    The following commands create a virtual environment named as tfs using Python v3.9.13 and associate that environment with the current folder, i.e., ~/tfs-ctrl. That way, when you are in that folder, the associated virtual environment will be used, thus inheriting the Python interpreter, i.e., Python v3.9.13, and the Python packages installed on it.

    cd ~/tfs-ctrl
    pyenv virtualenv 3.9.13 tfs
    pyenv local 3.9.13/envs/tfs

    In case that the correct pyenv does not get automatically activated when you change to the tfs-ctrl/ folder, then execute the following command:

    cd ~/tfs-ctrl
    pyenv activate 3.9.13/envs/tfs

    After completing these commands, you should see in your prompt that now you're within the virtual environment 3.9.13/envs/tfs on folder ~/tfs-ctrl:

    (3.9.13/envs/tfs) tfs@tfs-vm:~/tfs-ctrl$

    2.1.7. Install the basic Python packages within the virtual environment

    From within the 3.9.13/envs/tfs environment on folder ~/tfs-ctrl, run the following commands to install the basic Python packages required to work with TeraFlowSDN.

    cd ~/tfs-ctrl
    ./install_requirements.sh