By sirthomasii
I tried everything in This question
I can’t get the virtual environment to use the installed packages.
using virtualenv yielded a “command not found” error
the following .sh file will run and ostensibly install the packages when running doctl serverless deploy
set -e
#virtualenv virtualenv
python3 -m venv virtualenv
source virtualenv/bin/activate
sudo pip3 install -r requirements.txt --target virtualenv/lib/python3.9/site-packages
deactivate
but getting “No module found” errors at runtime.
Documentation for functions is lackluster at best. How can it be so difficult to simply install requirements?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
the following .sh file
The answer from my colleague that you linked is the correct approach, but I do notice that it’s a bit out of date. We now recommend customers exclude dependencies like pip from the virtual env.
Check out https://github.com/digitalocean/sample-functions-python-jokes for an example. Note the file https://github.com/digitalocean/sample-functions-python-jokes/blob/master/packages/joke/joke/build.sh in particular.
Documentation for functions is lackluster at best.
We have heard feedback that it could use more information. We’re working on updates right now. Feel free to give feedback about docs using our official feedback platform too (https://ideas.digitalocean.com/).
Regarding the function you’re trying to deploy here, feel free to respond here or open a support ticket if it’s still not working for you after following the example I linked.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.