Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 tasks done
matthewfollegot opened this issue Feb 11, 2022 · 3 comments
Closed
4 tasks done

Comments

@matthewfollegot
Copy link

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
@pgrzesik
Copy link
Contributor

Hello @matthewfollegot - thanks for reporting. In the listing you show using python3.6, the same is shown by the output. While above, you show that it's installed for python3.9. Additionally, maybe you can build it without using Docker? Is there a particular reason as to why you do that here?

Also, I'm going to move this issue to plugin's repository

@pgrzesik pgrzesik transferred this issue from serverless/serverless Feb 12, 2022
@matthewfollegot
Copy link
Author

Hello @pgrzesik. I had tried with python3.6 as well at the time, but now that I took another look at what was going on, I failed to regenerate requirements.txt so it was still looking for filelock==3.4.2 which only existed for python3.9. Apologies for the hassle.

@pgrzesik
Copy link
Contributor

No worries @matthewfollegot, thanks for the update and happy to see that you've been able to resolve this issue 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants