Report this

What is the reason for this report?

How to install opencv with serverless function [python]?

Posted on January 20, 2023

Adding a python dependency to a DigitalOcean function seems straight-forward: https://www.digitalocean.com/community/questions/how-to-install-python-requirements-with-serverless-function

It appears to work when I install numpy and Pillow:
requirements.txt

numpy==1.24.1
Pillow==9.4.0

However, I’m having trouble when trying to add opencv:

opencv-python==4.7.0.68

When attempting to deploy from the CLI I get this error:

Error: While deploying action ‘test/crop’ (running remote build): The action exhausted its memory and was aborted.

Any tips?



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!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

Your function seems to be running out of memory according to this part of the output that you’ve shared:

The action exhausted its memory and was aborted.

I’ve just answered a similar question on how to increase your function memory limit, I would recommend following the steps here:

https://www.digitalocean.com/community/questions/problem-in-working-with-xml-parsing-by-python

Let me know if you have any questions!

Best,

Bobby

The developer cloud

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

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.