I'm trying to create an AWS Lambda Deployment Package, so I can use it as an AWS Lambda Layer. Specifically, I'm trying to use the ipopt sovler, in conjuction with the pyomo and cython. I can get the pyomo packaged without issue, but when I try to pip install ipopt for the package I get an error:
ERROR: Command errored out with exit status 1:
command: 'c:\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\username\\AppData\\Local\\Temp\\pip-install-rir_unvz\\ipopt\\setup.py'"'"'; __file__='"'"'C:\\Users\\username\\AppData\\Local\\Temp\\pip-install-rir_unvz\\ipopt\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\username\AppData\Local\Temp\pip-record-d1o_oqjy\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python36\Include\ipopt'
cwd: C:\Users\username\AppData\Local\Temp\pip-install-rir_unvz\ipopt\
Complete output (20 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\ipopt
copying ipopt\ipopt_wrapper.py -> build\lib.win-amd64-3.6\ipopt
copying ipopt\version.py -> build\lib.win-amd64-3.6\ipopt
copying ipopt\__init__.py -> build\lib.win-amd64-3.6\ipopt
running build_ext
skipping 'src\cyipopt.c' Cython extension (up-to-date)
building 'ipopt.cyipopt' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
creating build\temp.win-amd64-3.6\Release\src
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Iinclude_mt/coin -Ic:\python36\lib\site-packages\numpy\core\include -Ic:\python36\include -Ic:\python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcsrc\cyipopt.c /Fobuild\temp.win-amd64-3.6\Release\src\cyipopt.obj
cyipopt.c
c:\python36\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
src\cyipopt.c(569): fatal error C1083: Cannot open include file: 'IpStdCInterface.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\username\\AppData\\Local\\Temp\\pip-install-rir_unvz\\ipopt\\setup.py'"'"'; __file__='"'"'C:\\Users\\username\\AppData\\Local\\Temp\\pip-install-rir_unvz\\ipopt\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\username\AppData\Local\Temp\pip-record-d1o_oqjy\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python36\Include\ipopt' Check the logs for full command output.
I am trying to run the pyomo/ipopt package in an AWS lambda function. This package isn't in the SDK, so I've read that I'll have to compile the dependencies into a zip, and then upload the zip into the lambda function.
I've done some research and tried out the links below, but when I try to pip install ipopt I get error messages - I'm on a Windows box, but I've also tried it on the Linux EC2 instance
Appreciate the help!
https://aws.amazon.com/premiumsupport/knowledge-center/lambda-python-package-compatible/
Unable to install cvxpy into virtualenv for AWS lambda
https://medium.com/@qtangs/creating-new-aws-lambda-layer-for-python-pandas-library-348b126e9f3e
https://github.com/coin-or/Ipopt
https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html