我正在使用apache-beam推荐格式创建setup.py文件:(Apache Beam Python 3.5 SDK 2.20.0)https://github.com/apache/beam/blob/master/sdks/python/apache_beam/examples/complete/juliaset/setup.py
当我有一个apt-get install命令时,一切运行良好。一旦我添加了另外两个apt-get安装:
工作:
CUSTOM_COMMANDS = [['echo', 'Custom command worked!'],
['apt-get', 'update'],
['apt-get', 'install', '-y', 'unzip']]
在解压缩安装时引发错误:
CUSTOM_COMMANDS = [['echo', 'Custom command worked!'],
['apt-get', 'update'],
['apt-get', 'install', '-y', 'unzip'],
['apt-get', 'install', '-y', 'default-jre'],
['apt-get', 'install', '-y', 'perl']]
错误:
RuntimeError: Command ['apt-get', 'install', '-y', 'unzip'] failed: exit code: 100
知道我想念什么吗?
谢谢,eilalan
我已经重新创建了您的方案,并得到与ApacheBeam SDK 2.20.0
版本相同的错误。当我更改2.16.0
和2.19.0
的版本时,它开始可以正常工作,没有任何问题。
这是我的setup.py
文件的外观:
from __future__ import absolute_import
from __future__ import print_function
import subprocess
from distutils.command.build import build as _build
import setuptools
CUSTOM_COMMANDS = [['apt-get', 'update'],
['apt-get', '--assume-yes', 'install', 'unzip'],
['apt-get', '--assume-yes', 'install', 'default-jre'],
['apt-get', '--assume-yes', 'install', 'perl']]
class CustomCommands(setuptools.Command):
"""A setuptools Command class able to run arbitrary commands."""
def initialize_options(self):
pass
def finalize_options(self):
pass
def RunCustomCommand(self, command_list):
print
'Running command: %s' % command_list
p = subprocess.Popen(
command_list,
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
# Can use communicate(input='y\n'.encode()) if the command run requires
# some confirmation.
stdout_data, _ = p.communicate()
print
'Command output: %s' % stdout_data
if p.returncode != 0:
raise RuntimeError(
'Command %s failed: exit code: %s' % (command_list, p.returncode))
def run(self):
for command in CUSTOM_COMMANDS:
self.RunCustomCommand(command)
REQUIRED_PACKAGES = [
]
PACKAGE_NAME = 'my_package'
PACKAGE_VERSION = '0.0.1'
setuptools.setup(
name=PACKAGE_NAME,
version=PACKAGE_VERSION,
description='Test project',
install_requires=REQUIRED_PACKAGES,
packages=setuptools.find_packages(),
cmdclass={
'build': build,
'CustomCommands': CustomCommands,
}
)
目前,解决方法是使用旧版本的ApacheBeam SDK
。我相信ApacheBeam SDK 2.20.0
中存在错误,您可以填写form以在IssueTracker上报告错误。
我希望您发现上述有用的信息。