首页 > 解决方案 > Apache Beam - pip install '.[gcp,test]' - RuntimeError: Not in apache git tree; 找不到原型定义

问题描述

我正在尝试遵循使用 Python SDK 开发的 Apache Beam 贡献指南

使用 Python 2.7.15 步骤:

  1. git clone git@github.com:apache/beam.git
  2. 创建一个新的虚拟环境 (--no-side-packages )
  3. 点安装cython
  4. pip install '.[gcp,test]' 在这个 sdks/python 目录上运行

输出:

pip install '.[gcp,test]' 
    Processing /Users/jcc/beam/sdks/python
    Complete output from command python setup.py egg_info:
    Compiling apache_beam/coders/stream.pyx because it changed.
    Compiling apache_beam/runners/worker/statesampler_fast.pyx because it changed.
    Compiling apache_beam/transforms/cy_dataflow_distribution_counter.pyx because it changed.
    Compiling apache_beam/coders/coder_impl.py because it changed.
    Compiling apache_beam/metrics/execution.py because it changed.
    Compiling apache_beam/runners/common.py because it changed.
    Compiling apache_beam/runners/worker/logger.py because it changed.
    Compiling apache_beam/runners/worker/opcounters.py because it changed.
    Compiling apache_beam/runners/worker/operations.py because it changed.
    Compiling apache_beam/transforms/cy_combiners.py because it changed.
    Compiling apache_beam/utils/counters.py because it changed.
    Compiling apache_beam/utils/windowed_value.py because it changed.
    [ 1/12] Cythonizing apache_beam/coders/coder_impl.py
    [ 2/12] Cythonizing apache_beam/coders/stream.pyx
    [ 3/12] Cythonizing apache_beam/metrics/execution.py
    [ 4/12] Cythonizing apache_beam/runners/common.py
    [ 5/12] Cythonizing apache_beam/runners/worker/logger.py
    [ 6/12] Cythonizing apache_beam/runners/worker/opcounters.py
    [ 7/12] Cythonizing apache_beam/runners/worker/operations.py
    [ 8/12] Cythonizing apache_beam/runners/worker/statesampler_fast.pyx
    [ 9/12] Cythonizing apache_beam/transforms/cy_combiners.py
    [10/12] Cythonizing apache_beam/transforms/cy_dataflow_distribution_counter.pyx
    [11/12] Cythonizing apache_beam/utils/counters.py
    [12/12] Cythonizing apache_beam/utils/windowed_value.py
    /Users/h4rry/env_beam/lib/python2.7/site-packages/setuptools/dist.py:398: UserWarning: Normalizing '2.7.0.dev' to '2.7.0.dev0'
    normalized_version,
    running egg_info
    /private/var/folders/k9/6y5rqvq91fv360rq0p271mkr0000gn/T/pip-req-build-YZpmvt/../common
    Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/k9/6y5rqvq91fv360rq0p271mkr0000gn/T/pip-req-build-YZpmvt/setup.py", line 218, in <module>
        'test': generate_protos_first(test),
    File "/Users/h4rry/env_beam/lib/python2.7/site-packages/setuptools/__init__.py", line 131, in setup
        return distutils.core.setup(**attrs)
    File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
    File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
    File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
    File "/private/var/folders/k9/6y5rqvq91fv360rq0p271mkr0000gn/T/pip-req-build-YZpmvt/setup.py", line 152, in run
        gen_protos.generate_proto_files()
    File "gen_protos.py", line 68, in generate_proto_files
        'Not in apache git tree; unable to find proto definitions.')
    RuntimeError: Not in apache git tree; unable to find proto definitions.

    ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/k9/6y5rqvq91fv360rq0p271mkr0000gn/T/pip-req-build-YZpmvt/

第 68 行中的文件“gen_protos.py”:

if not os.path.exists(common):
        raise RuntimeError(
            'Not in apache git tree; unable to find proto definitions.') 

它失败了,因为这条路径不存在:

当时常见的是:

/private/var/folders/k9/6y5rqvq91fv360rq0p271mkr0000gn/T/pip-req-build-YZpmvt/../common

我对光束很陌生,我错过了什么吗?

标签: python-2.7sdkapache-beam

解决方案


由于您是从源代码安装 Apache Beam,因此您需要使用-e传入的标志进行安装,以便以“可编辑”模式安装。:

pip install -e .[gcp,test]


推荐阅读