Pyflink 提交到本地集群报错

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Pyflink 提交到本地集群报错

Huilin_WU
我在terminal中用python xx.py文件就可以执行,然而用flink run -m localhost:8081 -py
xx.py就会报上面的错误说没有pyflink的组件。
(base) huilin@huilin-Lenovo:~/Documents/Learning/experiment$ flink run -m
localhost:8081 -py demo_predict.py
Traceback (most recent call last):
  File "demo_predict.py", line 51, in <module>
    from pyflink.common.serialization import SimpleStringEncoder
ModuleNotFoundError: No module named 'pyflink.common.serialization'

我已经试了很多方法,创建了虚拟环境在里面安装了对应的包,还是不行。请问有什么解决办法?



--
Sent from: http://apache-flink.147419.n8.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Pyflink 提交到本地集群报错

Shuiqiang Chen
Huilin 你好,

你用的是哪个版本的Flink呢?

Huilin_WU <[hidden email]> 于2021年3月10日周三 上午9:39写道:

> 我在terminal中用python xx.py文件就可以执行,然而用flink run -m localhost:8081 -py
> xx.py就会报上面的错误说没有pyflink的组件。
> (base) huilin@huilin-Lenovo:~/Documents/Learning/experiment$ flink run -m
> localhost:8081 -py demo_predict.py
> Traceback (most recent call last):
>   File "demo_predict.py", line 51, in <module>
>     from pyflink.common.serialization import SimpleStringEncoder
> ModuleNotFoundError: No module named 'pyflink.common.serialization'
>
> 我已经试了很多方法,创建了虚拟环境在里面安装了对应的包,还是不行。请问有什么解决办法?
>
>
>
> --
> Sent from: http://apache-flink.147419.n8.nabble.com/
>
Reply | Threaded
Open this post in threaded view
|

Re: Pyflink 提交到本地集群报错

Dian Fu
从报错看,似乎是作业运行的时候,找不到pyflink,如果确实是这样的话,有几个解决方案:
- 通过API指定集群端的Python路径: set_python_executable,参考 [1]
- 通过配置python.executable,参考[2]

[1]
https://ci.apache.org/projects/flink/flink-docs-release-1.12/dev/python/table-api-users-guide/dependency_management.html
[2]
https://ci.apache.org/projects/flink/flink-docs-release-1.12/dev/python/python_config.html#python-executable


On Wed, Mar 10, 2021 at 11:09 AM Shuiqiang Chen <[hidden email]> wrote:

> Huilin 你好,
>
> 你用的是哪个版本的Flink呢?
>
> Huilin_WU <[hidden email]> 于2021年3月10日周三 上午9:39写道:
>
> > 我在terminal中用python xx.py文件就可以执行,然而用flink run -m localhost:8081 -py
> > xx.py就会报上面的错误说没有pyflink的组件。
> > (base) huilin@huilin-Lenovo:~/Documents/Learning/experiment$ flink run
> -m
> > localhost:8081 -py demo_predict.py
> > Traceback (most recent call last):
> >   File "demo_predict.py", line 51, in <module>
> >     from pyflink.common.serialization import SimpleStringEncoder
> > ModuleNotFoundError: No module named 'pyflink.common.serialization'
> >
> > 我已经试了很多方法,创建了虚拟环境在里面安装了对应的包,还是不行。请问有什么解决办法?
> >
> >
> >
> > --
> > Sent from: http://apache-flink.147419.n8.nabble.com/
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Pyflink 提交到本地集群报错

Huilin_WU
你好,谢谢你的回复,现在更新到V1.12就可以直接运行了



--
Sent from: http://apache-flink.147419.n8.nabble.com/