Error deploying python "ephem" module

Hey, all. Brand new to Serverless, so apologies if I’m leaving out information.

I’m trying to build a python 3.6 function, and I’m using the serverless-python-requirements plugin. One of the lines in my requirements file is “ephem>3.7”. This all installs fine with “pip install -r”. But when I run “serverless deploy”, I see:

Building wheels for collected packages: ephem
Running bdist_wheel for ephem: started
Running bdist_wheel for ephem: finished with status ‘error’


   #include "Python.h"
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1


STDERR: Failed building wheel for ephem
Command “/usr/bin/python3.8 -u -c “import setuptools, tokenize;file=’/tmp/pip-build-bpsw6dcd/ephem/’;f=getattr(tokenize, ‘open’, open)(file);’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-ouv9lswu-record/install-record.txt --single-version-externally-managed --compile --home=/tmp/tmp8jmp8vp1” failed with error code 1 in /tmp/pip-build-bpsw6dcd/ephem/

What’s going on here? Is there a fix or workaround?


Most of the time these are dependency-issues. You need to install a package called python-dev. This package includes header files, a static library and development tools for building Python modules, extending the Python interpreter or embedding Python in applications. When encountering this error please note before the error it may say you are missing a package or header file — you should find those and install them and verify if it works

For Python 2.x use:

$ sudo apt-get install python-dev

If you using python 3, try to replace python-dev with python3-dev

For a specific version of Python 3, replace x with the minor version in

$ sudo apt-get install python3.x-dev