Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

I’m attempting to deploy a serverless functions package to Digital Ocean’s functions namespace. The issue is that I can deploy it without problem when I stay within the Python 3.11 libraries. But as soon as I need another library (not within this runtime), my function fails.
Here’s the steps I’ve taken:
example-project/
├── lib
| └── common
│ └── __init__.py
| └── static.py
│ └── __init__.py
├── packages
│ └── samples
│ └── func1
│ └── __main__.py
│ └── __init__.py
│ └── .include
│ └── requirements.txt
| └── func2
│ └── __main__.py
│ └── __init__.py
│ └── .include
│ └── requirements.txt
| └── func3
│ └── __main__.py
│ └── __init__.py
│ └── .include
│ └── requirements.txt
└── project.yml
└── .env
└── .gitignore
targetNamespace: "fn-************"
environment:
ENV: production
DO_SPACES_ACCESS_KEY: "${DO_SPACES_ACCESS_KEY}"
DO_SPACES_SECRET_KEY: "${DO_SPACES_SECRET_KEY}"
DO_SPACES_REGION: "${DO_SPACES_REGION}"
DO_SPACES_ENDPOINT: "${DO_SPACES_ENDPOINT}"
DO_SPACES_BUCKET: "${DO_SPACES_BUCKET}"
packages:
- name: golf
functions:
- name: func1
runtime: python:3.11
main: main # function inside __main__.py
web: false
environment:
ENV: production
- name: func2
runtime: python:3.11
main: main
web: false
environment:
ENV: production
- name: func3
runtime: python:3.11
main: main
web: false
environment:
ENV: production
__main__.py
requirements.txt
../../../lib/common
../../../lib
doctl serverless deploy . --remote-buildI did see the functions deployed, but when I invoked them, they got an error saying that the modules (listed in requirements.txt) could not be found.
I also tried to add a build.sh with the following basic script:
#!/bin/bash
pip install -r requirements.txt -t .
This did not do anything. And I tried other variations-- all of which did not work. NOTE: I did make this executable chmod +x packages/samples/*/build.sh
I’m looking for help on adding these libraries to serverless functions. I’m new to Digital Ocean, but the documentation is lacking on how you specifically should add packages to serverless functions that aren’t in the primary runtime environment (Python 3.11). If there is no clear solution, I will have to either containerize an application or set it up on a droplet. These latter alternatives I was looking to avoid since this is a very basic job and doesn’t require that much compute.
Appreciate your help.
Rory McEwan
Anjanesh Lekshminarayanan
182d09356ab94d3893ddfaca4f0270
Prashant Kumbhat
kprichard
e452769e8f30404d81a3bc803143f4
robert
Eleanor
GamesmenJordan
EricWVGG