I run the code with python3 and it works fine. However, when submitting the job to apache flink using the command flink run -py {path_code}
, I get an error java.
Is there anything that needs to be done before submitting a python job? if it is a file with a .jar extension, it will run fine.
I have installed apache-flink, python version 3.10.
PyFlink
relies on a Java Virtual Machine to execute the Flink core and a Python interpreter to run your Python code. This means Flink needs to know where to find your Python executable.
Your Python version is 3.10 so it should be
flink run -pyexec /usr/bin/python3.10 -py {path_code}
Use the command which python3.10
in your terminal to find the location of your Python 3.10 installation. If the result is different from /usr/bin/python3.10
, use the path you obtained instead.
You can configure the Python executable path within Flink's configuration files, which avoids having to specify it on the command line every time you submit a job.
flink-conf.yaml
in a text editor.python.executable: /path/to/your/python3.x
. Replacing /path/to/your/python3.x
with the actual path to your Python executable.