Collecting Flask==1.1.2
Downloading Flask-1.1.2-py2.py3-none-any.whl (94 kB)
Collecting tensorflow==2.4.0
Downloading tensorflow-2.4.0-cp38-cp38-manylinux2010_x86_64.whl (394.8 MB)
ERROR: Exception:
Traceback (most recent call last):
File "/var/lang/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 171, in _merge_into_criterion
crit = self.state.criteria[name]
KeyError: 'tensorflow'
During handling of the above exception, another exception occurred:
File "/var/lang/lib/python3.8/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 52, in _close
self.__callback(self.__buf.getvalue())
File "/var/lang/lib/python3.8/site-packages/pip/_vendor/cachecontrol/controller.py", line 309, in cache_response
cache_url, self.serializer.dumps(request, response, body=body)
File "/var/lang/lib/python3.8/site-packages/pip/_vendor/cachecontrol/serialize.py", line 72, in dumps
return b",".join([b"cc=4", msgpack.dumps(data, use_bin_type=True)])
File "/var/lang/lib/python3.8/site-packages/pip/_vendor/msgpack/__init__.py", line 35, in packb
return Packer(**kwargs).pack(o)
File "/var/lang/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.py", line 960, in pack
self._pack(obj)
File "/var/lang/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.py", line 943, in _pack
return self._pack_map_pairs(
File "/var/lang/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.py", line 1045, in _pack_map_pairs
self._pack(v, nest_limit - 1)
File "/var/lang/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.py", line 943, in _pack
return self._pack_map_pairs(
File "/var/lang/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.py", line 1045, in _pack_map_pairs
self._pack(v, nest_limit - 1)
File "/var/lang/lib/python3.8/site-packages/pip/_vendor/msgpack/fallback.py", line 889, in _pack
return self._buffer.write(obj)
MemoryError
The command '/bin/sh -c python3.8 -m pip install -r requirements.txt' returned a non-zero code: 2
跟随这篇博客为lambda URL创建容器镜像:https://aws.amazon.com/blogs/machine-learning/using-container-images-to-run-tensorflow-models-in-aws-lambda/
2条答案
按热度按时间guz6ccqo1#
这是内存错误。创建环境时,请使用更大容量的EC2示例。默认示例类型为t2.small。我使用的是c5.xlarge,TensorFlow安装正确。
ac1kyiln2#
当我使用t2.micro示例类型将我的Web应用部署到Elastic Beanstalk时,我遇到了完全相同的问题。在我更改为t2.medium示例后,一切都顺利工作。