Setting up Python for PyFlink
Before you can use Flink with the Python API, it is required to install and configure Python on every relevant node, or create and initialize a Python virtual environment.
- Connect to the Flink Gateway node using
CLI.
ssh root@[***FLINK GATEWAY NODE***]
You are prompted to provide your password to the cluster. - Check the version of
Python.
python --version
If the command fails or the versions are lower than 3.6, install Python. - Create a python virtual environment using the following
command:
conda create --copy -y -n flink_venv python=3.8
- Install PyFlink using the following
command:
python -m pip install apache-flink==1.19.1
- Install PyFlink on the YARN NameNode as well using the same steps.
When the Python installation is complete, you can submit Flink application that were created using the Python API.