Serverless-python-requirements: python setup.py egg_info" failed when running serverless deploy

Created on 4 Feb 2018  路  12Comments  路  Source: UnitedIncome/serverless-python-requirements

Hello, I am new to serverless.

I am following this article to deploy my lambda function
https://serverless.com/blog/serverless-python-packaging/

I have got the handler.py to run as expected in local virtualenv

However, I got this error when deploy

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-bHWJzZ/bcolz/

I have tried pip install --upgrade setuptools but the error still persisted

Any help is appreciated !

question waiting-on-response

Most helpful comment

Yeah, you should use the new psycopg2-binary package with this plugin.

All 12 comments

Are you using pipenv? I got a similar issue recently when doing that. I had to install pipenv in a new virtualenv for it to work. not sure why.

Do you mean PyEnv ?

I did use PyEnv to install python when I tried to resolve some issues relating to matplotlib not working .

Now I have tried to set up a new virtual env without using PyEnv at all. But I am getting the asme error.

Any suggestion on how to get rid of it ?

Thanks

nope, meant pipenv. Could you share your requirements.txt?

absl-py==0.1.10
appnope==0.1.0
backports-abc==0.5
backports.functools-lru-cache==1.5
backports.shutil-get-terminal-size==1.0.0
backports.weakref==1.0.post1
bcolz==1.1.2
bleach==2.1.2
certifi==2018.1.18
configparser==3.5.0
cycler==0.10.0
decorator==4.2.1
entrypoints==0.2.3
enum34==1.1.6
ez-setup==0.9
funcsigs==1.0.2
functools32==3.2.3.post2
futures==3.2.0
h5py==2.7.1
html5lib==0.9999999
ipykernel==4.8.0
ipython==5.5.0
ipython-genutils==0.2.0
ipywidgets==7.1.1
Jinja2==2.10
jsonschema==2.6.0
jupyter==1.0.0
jupyter-client==5.2.2
jupyter-console==5.2.0
jupyter-core==4.4.0
Keras==1.2.2
Markdown==2.6.11
MarkupSafe==1.0
matplotlib==2.1.2
mistune==0.8.3
mock==2.0.0
mpmath==1.0.0
nbconvert==5.3.1
nbformat==4.4.0
notebook==5.4.0
numpy==1.14.0
pandas==0.22.0
pandocfilters==1.4.2
pathlib2==2.3.0
pbr==3.1.1
pexpect==4.3.1
pickleshare==0.7.4
Pillow==5.0.0
prompt-toolkit==1.0.15
protobuf==3.5.1
ptyprocess==0.5.2
Pygments==2.2.0
pyparsing==2.2.0
python-dateutil==2.6.1
pytz==2017.3
PyYAML==3.12
pyzmq==16.0.4
qtconsole==4.3.1
scandir==1.6
scikit-learn==0.19.1
scipy==1.0.0
Send2Trash==1.4.2
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.11.0
subprocess32==3.2.7
sympy==1.1.1
tensorflow==1.5.0
tensorflow-tensorboard==1.5.0
terminado==0.8.1
testpath==0.3.1
Theano==1.0.1
tornado==4.5.3
traitlets==4.3.2
wcwidth==0.1.7
Werkzeug==0.14.1
widgetsnbextension==3.1.3

Any updates? I am getting

Error: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-pjla71ry/psycopg2/

with dockerizePip: 'non-linux' (on macOS).

I have tried following all the steps below in AWS EC2 linux instance instead. This resolved the setup error.

https://serverless.com/blog/serverless-python-packaging/

sorry 'bout the slow reply, i've been on vacation. glad you got it workign @ClouddH. But I am able to recreate the issue using the issue with your requirements on an ubuntu machine. @th0th, mind sharing your setup too? (os, python installation type, requrements.txt)

I am on MacOS with dockerizePip: 'non-linux'.

I got confused by psycopg2's new binary and non-binary stuff. I got the mentioned error when I had

psycopg2>=2.7,<2.8 --no-binary psycopg2

on requirements.txt. Then I added

psycopg2==2.7.4

and looks like it is working OK now.

Yeah, you should use the new psycopg2-binary package with this plugin.

@dschep Oh, that was quick :) Thanks.

Same error here using PyGreSQL.

serverless.yml
custom:
pythonRequirements:
dockerizePip: non-linux

requirement.txt
PyGreSQL==5.0.4

Getting exactly this error:
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-_owczb50/PyGreSQL/

@fabian818 it seems PyGreSQL doesn't have binary manylinux wheels on PyPi. You can try using the various docker options to use a dockerfile that has the necessary dependencies (probably libpq-devel) installed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amitm02 picture amitm02  路  6Comments

davegravy picture davegravy  路  5Comments

brettdh picture brettdh  路  5Comments

sepulworld picture sepulworld  路  5Comments

amitm02 picture amitm02  路  5Comments