-
Notifications
You must be signed in to change notification settings - Fork 293
Invalid requirement: '\x00' #442
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
Comments
I have the same issue. I ended up installing the modules in the root folder (not neat solution but it worked at the end). |
I solved this problem by saving the contents of requirements.txt as ascii, not unicode. Worked fine after that. |
Worked for me too. Although I would like o understand why and if serverless itself can't handle this conversion. |
The above helped fix the problem for me too, but I think I may have figured out what the underlying issue is here. If you're running
Moreover, it looks like even though this is corrected in the current latest release for PowerShell, the
and
respectively. This doesn't appear to be an issue with this plugin, the way to fix it definitively is to execute: pip freeze | Out-File -Encoding UTF8 requirements.txt when generating requirements files on PowerShell or use the original redirection method on Command Prompt. |
Converting the However, I wonder where this goes wrong? |
@f00f i haven’t touched this in a while but if I recall correctly that isn’t the issue. It’s that the serverless plug-in rewrites the file to another directory and it assumes a UTF8 encoding when it opens it. The failure happens when it attempts to read the UTF16LE file like a UTF8 and then dump it to another requirements.txt file. So pip install may work fine but the rewrite portion of the plug-in is more brittle. This is to guard against that. Hope that helps! |
pip freeze | Out-File -Encoding UTF8 requirements.txt it's work it for me
|
@pgrzesik: Would a "fix" be to check the file encoding before opening it as utf8, and if it's a different encoding, issue an error and exit? |
Yes I did face the same issue and thankyou for sharing the fix in the comments. I am trying to run serverless on windows 11. @n-wagner |
I ended up following this this to the letter on two different PCs:
https://serverless.com/blog/serverless-python-packaging/
But I still get the same error everywhere:
The requirements.txt is absolutely fine in my project root folder but when I look at it in the .serverless folder it looks completely messed up:
root:

.serverless:

I can not replace it as the plugin copies it every time serverless tries to package the thing so what am I doing wrong?
The text was updated successfully, but these errors were encountered: