-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
SAM CLI Build Not Recognizing requirements.txt File #6962
Comments
Hi @Mason-Stahl, thanks for reporting the issue. Can you try changing the
This is assuming the Lambda handler is defined in
|
@hnnasit Thank you so much! That fixed it! I'm new to this kind of stuff and wondering what the best practice would be if file.py has some imports in other parts of the code like in DiscordBots/my_package? Now that URI points specifically to recommendations/src it seems like I have two options to get the higher level my_package files into recommendations/src, i can use symlink or a custom build script. Is there another better option? My end goal, I believe, is for DiscordBots folder to be in an ec2 instance, with lambda scheduling the execution of certain commands/files within the recommendations folder. if it helps at all one of the imports is get_connection_pool() with my_package/src/db/async_db.py having a function to initiate a connection pool that is checked when accessing the database for any necessary DiscordBots command |
The options you mentioned would work. Another option is to use
If you want to have multiple lambda functions with shared files, you could also checkout Lambda layers. Let me know if that helps or if you have more questions. |
I am closing this issue due to inactivity. Please open a new issue if you still have questions. |
|
When running sam build, the CLI does not recognize the presence of the requirements.txt file and continues the build without dependencies, even though the file exists at the specified location.
I am trying to install dependencies so i can import for my python file at DiscordBots\recommendations\src\file.py
"C:\Users\turtl\root_lambda\DiscordBots\recommendations\src\requirements.txt"
requirements.txt contains exclusively :
Within root_lambda\template.yaml :
I run the command:
OS: Windows
SAM CLI Version: (SAM CLI, version 1.115.0)
Python Version: (Python 3.12.0)
Troubleshooting steps already taken:
Ensured requirements.txt is in the correct location.
Verified file encoding is UTF-8 without BOM.
Recreated requirements.txt to rule out hidden/special characters.
Checked for correct file naming without additional extensions or whitespace.
Ran sam build with and without the virtual environment activated.
Tried both relative and absolute paths in template.yaml's BuildProperties.
Ran sam build with the --debug flag for detailed output.
The text was updated successfully, but these errors were encountered: