Skip to content

serverless(-flask) deploy package distribution doesn't exist #673

Closed
@matthewfollegot

Description

@matthewfollegot

Are you certain it's a bug?

  • Yes, it looks like a bug

Is the issue caused by a plugin?

  • It is not a plugin issue

Are you using the latest version?

  • Yes, I'm using the latest version

Is there an existing issue for this?

  • I have searched existing issues, it hasn't been reported yet

Issue description

serverless deploy fails due to a missing python dependency. After debugging I have narrowed it down to the following:

ERROR: Could not find a version that satisfies the requirement filelock==3.4.2
ERROR: No matching distribution found for filelock==3.4.2

Meanwhile, this package exists for me in the venv/ directory of the project.

$ ls venv/lib/python3.9/site-packages/ | grep filelock
filelock
filelock-3.4.2.dist-info

I've tried recreating a project and tried setting the python version to 3.9 in serverless.yml but neither have worked.

Service configuration (serverless.yml) content

# serverless.yml

service: serverless-flask

plugins:
  - serverless-python-requirements
  - serverless-wsgi

custom:
  wsgi:
    app: app.app
    packRequirements: false
  pythonRequirements:
    dockerizePip: non-linux

provider:
  name: aws
  runtime: python3.6
  stage: dev
  region: us-east-1

functions:
  app:
    handler: wsgi.handler
    events:
      - http: ANY /
      - http: 'ANY /{proxy+}'

Command name and used flags

sls deploy

Command output

Deploying serverless-flask to stage dev (us-east-1)

✖ Stack serverless-flask-dev failed to deploy (5s)
Environment: darwin, node 16.3.0, framework 3.2.0, plugin 6.0.0, SDK 4.3.1
Credentials: Local, "default" profile
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error: `docker run --rm -v /Users/matthewfollegot/Library/Caches/serverless-python-requirements/5b774d933a626d6a785e1eb13a8db16044e8e5688f7894d8fef66d9caebc663c_x86_64_slspyc:/var/task:z -v /Users/matthewfollegot/Library/Caches/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z -u 0 lambci/lambda:build-python3.6 python3.6 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache` Exited with code 1
    at ChildProcess.<anonymous> (/Users/matthewfollegot/my-flask-application/node_modules/child-process-ext/spawn.js:38:8)
    at ChildProcess.emit (node:events:394:28)
    at ChildProcess.emit (node:domain:470:12)
    at maybeClose (node:internal/child_process:1067:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)


...


Looking into this a bit more, when I rerun the `docker run --rm -v...` command I get some more output which indicates the distribution for the package `filelock` doesn't exist.

$ docker run --rm -v /Users/matthewfollegot/Library/Caches/serverless-python-requirements/5b774d933a626d6a785e1eb13a8db16044e8e5688f7894d8fef66d9caebc663c_x86_64_slspyc:/var/task:z -v /Users/matthewfollegot/Library/Caches/serverless-python-requirements/downloadCacheslspyc:/var/useDownloadCache:z -u 0 lambci/lambda:build-python3.6 python3.6 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache
Collecting Flask==2.0.2
  Using cached Flask-2.0.2-py3-none-any.whl (95 kB)
Collecting Jinja2==3.0.3
  Using cached Jinja2-3.0.3-py3-none-any.whl (133 kB)
Collecting MarkupSafe==2.0.1
  Using cached MarkupSafe-2.0.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (30 kB)
Collecting Werkzeug==2.0.3
  Using cached Werkzeug-2.0.3-py3-none-any.whl (289 kB)
Collecting certifi==2021.10.8
  Using cached certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Collecting charset-normalizer==2.0.10
  Using cached charset_normalizer-2.0.10-py3-none-any.whl (39 kB)
Collecting click==8.0.3
  Using cached click-8.0.3-py3-none-any.whl (97 kB)
Collecting distlib==0.3.4
  Using cached distlib-0.3.4-py2.py3-none-any.whl (461 kB)
ERROR: Could not find a version that satisfies the requirement filelock==3.4.2
ERROR: No matching distribution found for filelock==3.4.2

Environment information

Framework Core: 3.2.0
Plugin: 6.0.0
SDK: 4.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions