fol*_*oof 6 python pip virtualenv elastic-map-reduce mrjob
我正在通过mrjob/boto模块向亚马逊的EMR发送代码.我有一些外部python依赖项(即numpy,boto等),目前必须下载python包的源代码,并将它们作为tarball发送到mrjob.config文件的"python_archives"字段中.
这使得依赖管理比我想要的更加混乱,并且想知道我是否能以某种方式使用相同的requirements.txt文件,我用于我的virtualenv设置以使用我的依赖项引导emr实例.是否可以在EMR实例上设置virtualenv并执行以下操作:
pip install -r requirements.txt
Run Code Online (Sandbox Code Playgroud)
就像我在当地?
小智 3
实现此目的的一种方法是使用引导操作。您可以使用它们来运行 shell 脚本。
如果你有一个设置 python 文件,它执行以下操作:
requirements = open("requirements.txt", "r")
shell_script = open("pip.sh", "w+")
shell_script.write("sudo apt-get install python-pip\n")
for line in requirements:
shell_script.write("sudo pip install -I " + line)
Run Code Online (Sandbox Code Playgroud)
然后您可以将其作为引导操作运行,而无需上传您的requirements.txt