# install dependencies, get source, compile, install

```sh
sudo dnf install gcc libffi-devel openssl-libs openssl-devel libuuid-devel
mkdir ~/python
cd ~/python
wget https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tgz
tar -xvzf Python-3.10.6.tgz
mkdir ~/python/3.10.6                                                      # running directory
cd ~/python/Python-3.10.6                                                  # compile directory
./configure --prefix /opt/ocf_tseed/python/3.10.6
make -j$(nproc)
#make clean                                                                # if you install more dependencies
make -n install
make install
ll /opt/ocf_tseed/python/3.10.6
```

# create virtual environment with local python and activate

```sh
# create venv
/opt/ocf_tseed/python/3.10.6/bin/python3 -m venv --prompt 3.10.6 ~/.venv
source ~/.venv/bin/activate
python --version                                                           # check not system version
pip install --upgrade pip
```

# update bashrc

```sh

vi ~/.bashrc

# User specific aliases and functions
source $HOME/.venv/bin/activate
```

# manually start/stop venv

## start
```sh
source $HOME/.venv/bin/activate
```

## exit venv
```sh
deactivate
```

# install pip packages

The following pip packages are required for the playbook, netaddr is essential for ip filters and nmcli module, ansible-merge-vars is required for complex/deep variable overlay.

```sh
pip install netaddr ansible-merge-vars jmespath pip-autoremove
```

```sh
pip freeze > pip_requirements.txt

vi requirements.txt

ansible==6.2.0
ansible-core==2.13.3
netaddr==0.8.0
ansible-merge-vars==5.0.0

python -m pip install -r pip_requirements.txt
```