question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cant get dlib to run on AWS Lambda when compiling with OpenBLAS.

See original GitHub issue

Howdy!

I got the library working as a AWS Lambda function. I compiled it using their amazonlinux docker container, but as before the performance is really bad without the OpenBLAS support so i installed it using their yum package manager. Tried using blas, openblas, blas-devel and openblas-devel, openblas-static and also lapack and lapack-devel, but I keep ending up with these kind of errors:

libblas.so.3: cannot open shared object file: No such file or directory

or

libopenblas.so.0: cannot open shared object file: No such file or directory

when building the library (iside the amazonlinux docker container) i get this message at the end that makes me believe that the dependencies are not built statically:

Linking CXX shared library libdlib.so
[100%] Built target dlib_shared

or could it be some kind of path issue ?

the libpng and libX11 libraries doesn’t seem to have any issues, and i don’t really know the difference as the those are also installed using yum as the packages libX11-devel and libpng-devel.

feels like i somehow need to make sure that the openblas library is packaged together with dlib in my node_modules directory or some other way accessible when running in the lambda environment.

any ideas?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
henrydawsoncommented, Apr 4, 2018

Thanks @justadudewhohacks and @bobmoff for all the info in this issue. After a lot of false starts I was able to get it working on Lambda with OpenBlas. Below I’ve listed some of the key things that caused me trouble during the process so hopefully other people don’t waste time on these issues.

  • Compile on EC2 using the correct Amazon Linux AMI that Amazon uses for Lambda. A link to the AMI should be on this page https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html

  • Compile on EC2 using the exact same version of Node that you will run on Lambda. I used v8.10.0

  • Despite Amazon stating that there is a 50MB limit on the total zip size, I was able to upload zip files that are 170MB. (It’s possible that I applied for the limit on my account to be raised in the past, but I don’t remember doing that)

  • Take care when zipping up the deployment package. Using the standard MacOS Finder will not work as it places everything in a folder. You need to use the command line from within the folder (e.g. zip -r ../face-detection-lambda.zip *)

  • Copy the required shared libraries from EC2 (in my case libopenblas.so.0 and libgfortran.so.3) into the root folder of your deployment package, and add the following command to the start of the lambda function so lambda knows how to access them. process.env["PATH"] = process.env["PATH"] + ":" + process.env["LAMBDA_TASK_ROOT"]

1reaction
m-onzcommented, Feb 21, 2018

@bobmoff Thank you for creating https://github.com/bobmoff/face-recognition.js-as-a-function

I will test on google cloud function and AWS and get back to you with my findings. If I make any progress I will create a repository and send it over.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to load dlib in AWS Lambda - Stack Overflow
I'm creating a function in AWS Lambda that uses the DLIB package. I have it working fine locally, then to make sure i...
Read more >
Install dlib (the easy, complete guide) - PyImageSearch
This guide will show you the easy method to install the dlib library (with Python bindings) on Ubuntu, macOS, and Raspbian.
Read more >
Package List — Spack 0.20.0.dev0 documentation
Versions: 2.0.1, 2.0.0, 1.9.3, 1.9.2; Build Dependencies: java, maven; Run Dependencies: java; Description: Apache Accumulo is a sorted, ...
Read more >
Vcpkg: a tool to acquire and build C++ open source libraries ...
3fd 2.6.2 C++ Framework For Fast Development ace 6.5.1 The ADAPTIVE Communication Environment anax 2.1.0‑3 An open source C++ entity system. antlr4 4.7 ANother Tool for...
Read more >
Debian -- Source Packages in "stretch"
... golang-github-aws-aws-sdk-go (1.1.14+dfsg-2) ... google-android-build-tools-installer (23.0.3) [contrib] ... libdist-zilla-plugin-run-perl (0.043-1) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found