serverless-python-requirements
serverless-python-requirements copied to clipboard
Serverless Deploy fails on CircleCI with error "no such file or directory .serverless/requirements"
I get:
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Packaging Python Requirements Lambda Layer...
Error --------------------------------------------------
ENOENT: no such file or directory, scandir '.serverless/requirements'
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
OS: linux
Node Version: 6.16.0
Serverless Version: 1.44.1
error Command failed with exit code 1.
My serverless.yml configs looks like:
custom:
pythonRequirements:
dockerizePip: true
layer: true
functions:
aFunch:
handler: someHandler
events:
- s3:
bucket: aBucket
event: s3:ObjectCreated:*
layers:
- {Ref: PythonRequirementsLambdaLayer}
plugins:
- serverless-python-requirements
Looks like when I zip:true
or layer:true
; that is in any way requirements are zipped, the serverless deploy in CircleCI still looks for .serverless/requirements
dir and fails to find it.
sls deploy
on local works perfectly and so does aws lambda after deployment.
Have you declared anything else in your serverless.yml file?
I had the exact same issue (using CircleCI but as a stand alone single layer/no function stack) and had to remove individually: true
(left over code from a previous yml file).
I need more context to help you with this.
Experiencing the same issue with latest serverless version and package option individually: true
as well as zip: true
in pythonRequirements options.
When I disable zipping it's working.
Not using CircleCI, just on a Windows machine.
we're having something that looks a lot like this as well, only on Jenkins instead of CircleCI.
Serverless: Running ...
Serverless: Packaging service...
Serverless: Packaging Python Requirements Lambda Layer...
Error --------------------------------------------------
ENOENT: no such file or directory, scandir '.serverless/requirements'
our config is
pythonRequirements:
slim: true
useDownloadCache: true
useStaticCache: true
noDeploy: []
layer: true
we're on serverless-python-requirements
4.3.0.
I am using ubuntu, I got a similar issue just now. I think my problem was my setuptools were not setup correctly or not upgraded. Here is what I ran to fix this issue:
sudo apt install python3-widgetsnbextension
sudo apt install python3-testresources
pip install --upgrade --force setuptools --user
I did not change my serverless.yaml, but this is what have configured:
package:
individually: true
custom:
pythonRequirements:
fileName: requirements.txt
zip: true
# ...
# ...
Any updates on this? I still get this issue. I was able to get my function to run locally by setting the PYTHONPATH environment variable to each module in the serverless.yml script:
#serverless.yml
provider:
environment:
PYTHONPATH: ./function1;./function2;...
However, I don't know if this works in deployment, and I am also required to create a requirements.txt in the serverless.yml directory in order to deploy. To me, it would seem that the
package:
individually:
true
option is broken somehow, because requirements.txt shouldn't be required in the serverless.yml directory if individual packaging actually worked.
I believe this is still a problem - we're seeing this same error in GitLab where about half the builds fail. I've left a comment on a similar issue here: ENOENT: no such file or directory, scandir '.serverless/requirement'
I was having this issue as well. I had included a pyproject.toml file which I'm using to manage black. Serverless was looking at that file instead of requirements.txt.
If you have a pyproject.toml file, you have to include the following to use requirements.txt instead.
pythonRequirements:
usePoetry: false
Found this in the documentation
@jimbol Thanks for this, saved my day 🎉
I had some luck by changing the name of the service in the serverless.yml only alphanumeric characters, which, after some experimentation, was the output of other errors I was having.
gosh this is terrible, how do I get this to work?