Managing Python Dependencies in Serverless
In order to run the following commands, you need to have a Ubuntu (or any other Debian-based) work environment up and running!
Upgrade pip and virtaulenv
Run the following commands:
sudo -H pip3 install --upgrade pip sudo -H pip3 install virtualenv
- Then we need to create a virtaulenv
python3 -m venv your_venv
- Now we have to activate it.
- Install all the dependencies specified in the
pip install -r requirements.txt
Install the Serverless Python Requirements Plugin
sls plugin install -n serverless-python-requirements
This will automagically add the plugin to the
plugins: - serverless-python-requirements
- To make the package of python dependencies, run
- Now deploy it to AWS
All okay? Boom!