Huang Xingbo created FLINK-26666:
------------------------------------

             Summary: Improve the error message of pyflink and flink version 
mismatch
                 Key: FLINK-26666
                 URL: https://issues.apache.org/jira/browse/FLINK-26666
             Project: Flink
          Issue Type: Sub-task
          Components: API / Python
    Affects Versions: 1.16.0
            Reporter: Huang Xingbo


When a user runs a pyflink job locally, the following error will be reported 
because FLINK_HOME is set and the version of flink binaray is inconsistent with 
the version of pyflink:

{code:java}
Traceback (most recent call last):
  File "word_count.py", line 117, in <module>
    word_count(known_args.input, known_args.output)
  File "word_count.py", line 49, in word_count
    env = StreamExecutionEnvironment.get_execution_environment()
  File 
"/home/knaufk/.virtualenvs/flink-1.14/lib/python3.8/site-packages/pyflink/datastream/stream_execution_environment.py",
 line 732, in get_execution_environment
    gateway = get_gateway()
  File 
"/home/knaufk/.virtualenvs/flink-1.14/lib/python3.8/site-packages/pyflink/java_gateway.py",
 line 67, in get_gateway
    
_gateway.jvm.org.apache.flink.client.python.PythonEnvUtils.resetCallbackClient(
  File 
"/home/knaufk/.virtualenvs/flink-1.14/lib/python3.8/site-packages/py4j/java_gateway.py",
 line 1285, in __call__
    return_value = get_return_value(
  File 
"/home/knaufk/.virtualenvs/flink-1.14/lib/python3.8/site-packages/py4j/protocol.py",
 line 330, in get_return_value
    raise Py4JError(
py4j.protocol.Py4JError: An error occurred while calling 
z:org.apache.flink.client.python.PythonEnvUtils.resetCallbackClient. Trace:
org.apache.flink.api.python.shaded.py4j.Py4JException: Method 
resetCallbackClient([class 
org.apache.flink.api.python.shaded.py4j.GatewayServer, class java.lang.String, 
class java.lang.Integer]) does not exist
        at 
org.apache.flink.api.python.shaded.py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:318)
        at 
org.apache.flink.api.python.shaded.py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:339)
        at 
org.apache.flink.api.python.shaded.py4j.Gateway.invoke(Gateway.java:276)
        at 
org.apache.flink.api.python.shaded.py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
        at 
org.apache.flink.api.python.shaded.py4j.commands.CallCommand.execute(CallCommand.java:79)
        at 
org.apache.flink.api.python.shaded.py4j.GatewayConnection.run(GatewayConnection.java:238)
        at java.base/java.lang.Thread.run(Thread.java:829)
{code}
We can add some guiding suggestions in the error message:

{code:java}
you have two choices to solve this problem:
1. You can unset the FLINK_HOME environment variable.
2. Make sure that the flink version of FLINK_HOME is the same as the pyflink 
version
{code}





--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to