问题描述
当我尝试在AWS Lambda上部署无服务器应用程序时,发生以下错误:
STDERR: ERROR: aws-sam-cli 0.46.2 has requirement jmespath~=0.9.5,but you'll have jmespath 0.9.4 which is incompatible.
ERROR: Exception:
Traceback (most recent call last):
File "/var/lang/lib/python3.6/shutil.py",line 550,in move
os.rename(src,real_dst)
OSError: [Errno 18] Invalid cross-device link: '/tmp/pip-target-ykxrpsrj/lib/python/gast-0.3.3.dist-info' -> '/var/task/gast-0.3.3.dist-info'
During handling of the above exception,another exception occurred:
Traceback (most recent call last):
File "/var/lang/lib/python3.6/site-packages/pip/_internal/cli/base_command.py",line 186,in _main
status = self.run(options,args)
File "/var/lang/lib/python3.6/site-packages/pip/_internal/commands/install.py",line 454,in run
options.target_dir,target_temp_dir,options.upgrade
File "/var/lang/lib/python3.6/site-packages/pip/_internal/commands/install.py",line 512,in _handle_target_dir
target_item_dir
File "/var/lang/lib/python3.6/shutil.py",line 561,in move
symlinks=True)
File "/var/lang/lib/python3.6/shutil.py",line 321,in copytree
os.makedirs(dst)
File "/var/lang/lib/python3.6/os.py",line 220,in makedirs
mkdir(name,mode)
PermissionError: [Errno 13] Permission denied: '/var/task/gast-0.3.3.dist-info'
WARNING: You are using pip version 20.0.2; however,version 20.2.3 is available.
You should consider upgrading via the '/var/lang/bin/python3.6 -m pip install --upgrade pip' command.
我正在使用从头创建的新Anaconda环境,并且我的应用程序中的需求文件指出:
jmespath==0.9.5
在部署之前,我使用以下命令安装插件(例如tensorflow):
serverless plugin install -n serverless-python-requirements
Docker运行正常,我的serverless.yml文件包含以下内容:
plugins:
- serverless-python-requirements
custom:
pythonRequirements:
dockerizePip: true
zip: true
slim: true
noDeploy:
- boto3
- botocore
- docutils
- jmespath
- pip
- python-dateutil
- s3transfer
- setuptools
- six
- tensorboard
我该如何解决这个问题?
解决方法
正如另一个SO question所述,可能是由于我暂时关闭了experimental Docker feature called Use gRPC FUSE for file sharing。此后似乎可以部署。