Reputation: 40
I am just running a simple code, and installed java 21 as well, using flink version 1.19.0
from pyflink.table import EnvironmentSettings,TableEnvironment
setting = EnvironmentSettings.in_streaming_mode()
table_env = TableEnvironment.create(environment_settings=setting)
country_dict = {"1":"canda","2":"India"}
schema = ["id","country"]
table = table_env.from_elements(country_dict,schema=schema)
if __name__=="__main__"
print(table.get_schema())
print(table.execute())
getting error at line 2, in_streaming_mode().
I tried to uninstall and install again, tried to search online but not getting any result.
error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\91889\AppData\Roaming\Python\Python311\site-packages\pyflink\table\environment_settings.py", line 229, in
in_streaming_mode
return EnvironmentSettings.new_instance().in_streaming_mode().build()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\91889\AppData\Roaming\Python\Python311\site-packages\pyflink\table\environment_settings.py", line 196, in
new_instance
return EnvironmentSettings.Builder()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\91889\AppData\Roaming\Python\Python311\site-packages\pyflink\table\environment_settings.py", line 53, in __init__
gateway = get_gateway()
^^^^^^^^^^^^^
File "C:\Users\91889\AppData\Roaming\Python\Python311\site-packages\pyflink\java_gateway.py", line 64, in get_gateway
_gateway = launch_gateway()
^^^^^^^^^^^^^^^^
File "C:\Users\91889\AppData\Roaming\Python\Python311\site-packages\pyflink\java_gateway.py", line 110, in launch_gateway p = launch_gateway_server_process(env, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\91889\AppData\Roaming\Python\Python311\site-packages\pyflink\pyflink_gateway_server.py", line 315, in launch_gateway_server_process
return Popen(list(filter(lambda c: len(c) != 0, command)),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\subprocess.py", line 1024, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Program Files\Python311\Lib\subprocess.py", line 1509, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified
Upvotes: 0
Views: 97
Reputation: 24
This error indicates that JAVA is not installed in the machine. I believe pyflink is trying to find the JDK and coudn't find it. Make sure you install the JDK and ensure to set the environment variable. I faced the same issue and I was able to resolve it.
Upvotes: -1