On CentOS (CentOS 8.0.1905 (64bit)) I tried to run Python(3.6.8) Version of WordCount program on Flink(1.9) as described here. I got error as below. The same environment works fine with Java version of WordCount program. What is that I am missing here? Any help is greatly appreciated.
Error
$ ./bin/flink run -py examples/python/table/batch/word_count.py
Starting execution of program
org.apache.flink.client.program.OptimizerPlanEnvironment$ProgramAbortException
at org.apache.flink.client.python.PythonDriver.main(PythonDriver.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:576)
at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:438)
at org.apache.flink.client.program.ClusterClient.run(ClusterClient.java:274)
at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:746)
at org.apache.flink.client.cli.CliFrontend.runProgram(CliFrontend.java:273)
at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:205)
at org.apache.flink.client.cli.CliFrontend.parseParameters(CliFrontend.java:1010)
at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1083)
at org.apache.flink.runtime.security.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:30)
at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1083)
3
Answers
Thanks to Jincheng Sun for your encouragement and support
I moved $FLINK_HOME/opt/python/__MACOSX to one level above. Program ran without any errors. As I am running on Linux, I do not need __MACOSX. I will simply delete it
Before you run the test you should build the source and install the PyFlink by using pip, detail can be found here: https://ci.apache.org/projects/flink/flink-docs-release-1.9/flinkDev/building.html#build-pyflink.
I think the information you provided does not show root cause. Generally speaking,we have two ways to run the example in Flink 1.9, one is the answer 1 provided earlier, which is to install the PyFlink from source, and the other is to download the binary package. as follows:
Check the Python
python –version
It’s better to use Python 2.7.6+ for Flink 1.9.
Download
curl -O http://mirrors.gigenet.com/apache/flink/flink-1.9.1/flink-1.9.1-bin-scala_2.11.tgz
tar -zxvf flink-1.9.1-bin-scala_2.11.tgz
Config(Optional)
vi flink-1.9.1/conf/flink-conf.yaml -> rest.port: 4000
Start cluster
cd flink-1.9.1; bin/start-cluster.sh
Run word count example
./bin/flink run -py examples/python/table/batch/word_count.py
More detail can be found here:
https://enjoyment.cool/2020/01/19/Three-Min-Series-Run-the-Example-of-WordCount-in-PyFlink-1-9/#more
Hoping it is helpful to you!