在使用setup.py安装DataFlow工作人员的依赖关系时,我有以下错误:
CalledProcessError Traceback (most recent call last)
~/apache-beam-2.27.0/lib/python3.7/site-packages/apache_beam/utils/processes.py in check_output(*args, **kwargs)
90 try:
---> 91 out = subprocess.check_output(*args, **kwargs)
92 except OSError:
/opt/conda/lib/python3.7/subprocess.py in check_output(timeout, *popenargs, **kwargs)
410 return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
--> 411 **kwargs).stdout
412
/opt/conda/lib/python3.7/subprocess.py in run(input, capture_output, timeout, check, *popenargs, **kwargs)
511 raise CalledProcessError(retcode, process.args,
--> 512 output=stdout, stderr=stderr)
513 return CompletedProcess(process.args, retcode, stdout, stderr)
CalledProcessError: Command '['/root/apache-beam-2.27.0/bin/python', 'setup.py', 'sdist', '--dist-dir', '/tmp/tmpcljk596r']' returned non-zero exit status 1.我的Setup.py文件正是Apache提出的,我想安装2个python模块和一个apt-get:
CUSTOM_COMMANDS = [
['apt-get', 'update'],
['apt-get', '--assume-yes', 'install', 'poppler-utils']
]
REQUIRED_PACKAGES = ['pdf2image', 'poppler-utils']在我看来,这是一个非常痛苦的错误,因为在我看来,我使用的setup.py选项与使用apt-get安装依赖关系的方式完全相同。
和往常一样,使用DirectRunner就像一种魅力:)
我的配置:
谢谢你的帮忙
诚挚的问候
杰罗姆
发布于 2021-03-25 04:11:37
我最近遇到了一个类似的错误..。花了很长时间才修好。我不能代表所有的平台,也不能代表您的特定setup.py,但是我可以分享我如何在Windows上解决类似的问题,希望这能帮助您。
在apache源中,它使用Python的子进程模块运行安装命令(在这里您可以看到来自CalledProcessError的)。在Windows上,它在调用shell=True时强制参数check_output,这意味着它在特定于平台的shell中运行命令(通常是windows上的cmd.exe )。
作为第一步,验证您看到的抛出CalledProcessException的命令实际上并没有通过在shell中手动运行而抛出错误。在我的例子中,命令(Python学习.)在手动运行时按预期工作。
然后,如果您在Windows上,请确保powershell/cmd上的所有自动运行命令都能正常工作,并且不会抛出错误。如果您不在windows上,我认为您应该验证您的beam代码是否使用了shell=True,如果是的话,请确保您的shell的自动运行脚本正常工作。
在我的示例中,由Beam运行的Python命令在手动运行时运行良好。但是,当使用shell=True在子进程中执行时,shell中的一个坏掉的自动运行命令导致beam从子进程接收到一个错误代码,并认为该命令失败了。
-Tyler
https://stackoverflow.com/questions/65905104
复制相似问题