使用 python docker 3.9 - 3.12 安装 `apache-flink:1.19.0` 时出现问题

问题描述 投票:0回答:1

我在按照

官方教程
使用 python docker 3.9 - 3.12 安装
PyFlink
/apache-flink 1.19.0时遇到问题。

错误似乎与返回

NoneType
的路径有关,但我不知道如何修复它。

我没有发帖

python:3.12
,因为错误和其他人一样。

你能帮我解决这个问题吗?

非常感谢。

Python 3.9

docker run - it python:3.9 python - m pip install apache-flink

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [22 lines of output]
      Traceback (most recent call last):
        File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-rdoi1tww/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 162, in get_requires_for_build_wheel
          return self._get_build_requires(
        File "/tmp/pip-build-env-rdoi1tww/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 143, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-rdoi1tww/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 267, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/tmp/pip-build-env-rdoi1tww/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 158, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 169, in <module>
          include_dirs=get_java_include() + ['src/main/c/pemja/core/include'],
        File "setup.py", line 111, in get_java_include
          inc = os.path.join(get_java_home(), inc_name)
        File "/usr/local/lib/python3.9/posixpath.py", line 76, in join
          a = os.fspath(a)
      TypeError: expected str, bytes or os.PathLike object, not NoneType
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

Python 3.10

docker run - it python:3.10 python - m pip install apache-flink

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [22 lines of output]
      Traceback (most recent call last):
        File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-ptcni4h1/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 162, in get_requires_for_build_wheel
          return self._get_build_requires(
        File "/tmp/pip-build-env-ptcni4h1/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 143, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-ptcni4h1/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 267, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/tmp/pip-build-env-ptcni4h1/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 158, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 169, in <module>
          include_dirs=get_java_include() + ['src/main/c/pemja/core/include'],
        File "setup.py", line 111, in get_java_include
          inc = os.path.join(get_java_home(), inc_name)
        File "/usr/local/lib/python3.10/posixpath.py", line 76, in join
          a = os.fspath(a)
      TypeError: expected str, bytes or os.PathLike object, not NoneType
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Python 3.11

docker run - it python:3.11 python - m pip install apache-flink

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      Traceback (most recent call last):
        File "/usr/local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-jpt4cjc2/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 162, in get_requires_for_build_wheel
          return self._get_build_requires(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-jpt4cjc2/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 143, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-jpt4cjc2/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 268, in run_setup
          self).run_setup(setup_script=setup_script)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-jpt4cjc2/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 158, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 169, in <module>
          include_dirs=get_java_include() + ['src/main/c/pemja/core/include'],
                       ^^^^^^^^^^^^^^^^^^
        File "setup.py", line 111, in get_java_include
          inc = os.path.join(get_java_home(), inc_name)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "<frozen posixpath>", line 76, in join
      TypeError: expected str, bytes or os.PathLike object, not NoneType
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
python docker apache-flink
1个回答
0
投票

这些命令应该有效:

docker run -it python:3.9 pip install apache-flink
docker run -it python:3.10 pip install apache-flink
docker run -it python:3.11 pip install apache-flink

在所有情况下,

apache-flink
包都会安装到正在运行的容器上。但是,安装包后容器将立即终止,因此它不是很有用。

更有意义的是创建一个安装了软件包的新映像。

🗎

Dockerfile

FROM python:3.11

RUN pip install apache-flink==1.19.0

构建并运行。

docker build -t python-flink .
docker run -it python-flink

在运行的容器中,您将能够导入

pyflink

我没有发布 python:3.12,因为错误与其他人相同。

你确定吗?实际上,我在 Python 3.12 中遇到了一个不同的错误,看起来像是

apache-flink
包的版本兼容性问题。

© www.soinside.com 2019 - 2024. All rights reserved.