python version=3.6.3 apache-flink=1.15.4

When I try to create a TableEnvironment following the flink documentation, I got this: py4j.protocol.Py4JError: org.apache.flink.table.api.EnvironmentSettings.inBatchMode does not exist in the JVM

Code:

from pyflink.table import EnvironmentSettings, TableEnvironment

# create a batch TableEnvironment
env_settings = EnvironmentSettings.in_batch_mode()
table_env = TableEnvironment.create(env_settings)

table = table_env.from_elements([(1, 'Hi'), (2, 'Hello')])
table.to_pandas()

Output:

$ python3 demo.py 
Traceback (most recent call last):
  File "demo.py", line 4, in <module>
    env_settings = EnvironmentSettings.in_batch_mode()
  File "/home/venv/pyflink_1.15.4/lib64/python3.6/site-packages/pyflink/table/environment_settings.py", line 238, in in_batch_mode
    get_gateway().jvm.EnvironmentSettings.inBatchMode())
  File "/home/venv/pyflink_1.15.4/lib64/python3.6/site-packages/py4j/java_gateway.py", line 1548, in __getattr__
    "{0}.{1} does not exist in the JVM".format(self._fqn, name))
py4j.protocol.Py4JError: org.apache.flink.table.api.EnvironmentSettings.inBatchMode does not exist in the JVM

Here is the link of the documentation: Create a TableEnvironment

1

There are 1 answers

0
Damon Chen On

Solved. I forgot to upgrade my flink dist to 1.15.