Miserlou/Zappa

`zappa package` doesn't include dist-packages

Open

#905 opened on Jun 2, 2017

View on GitHub
 (8 comments) (4 reactions) (0 assignees)Python (11,903 stars) (1,286 forks)batch import
awsbughelp wantedneeds-test

Description

zappa --package bundles site-packages from the virtualenv. But, on some distributions, pip installs stuff into dist-packages. So, there is a problem that these platforms (e.g. AMI linux) that they don't include pip-installed packages when they zappa --package

Context

Do zappa --package on with an AMI linux box, or some other platform that does strange things to pip, so it installs stuff into dist-packages.

Expected Behavior

I would like to see all the stuff from dist-packages in the zappa package, so my thing works the same even if I build it on Amazon Linux.

Actual Behavior

The site-packages is included in the zappa package. The dist-packages are not. The stuff I installed with pip in my virtualenv is not included in the zappa package if I ran it on a wacky OS, and my thing doesn't work because it's requirements are not met.

Possible Fix

  • update create_handler_venv in zappa/core.py so it does stuff with dist-packages for the relevant platforms
  • update detect_flask_apps and detect_django_settings in zappa/utilities.py so they check dist-packages too
  • Is this maybe related to why /tests/tests.py#L70 is commented out?

Steps to Reproduce

  1. Make yourself at home in an AWS Linux AMI
  2. Create a virtualenv and activate it.
  3. pip install a bunch of stuff, such as the requirements for you app
  4. See for yourself how there is a bunch of stuff installed in dist-packages
  5. do zappa --package
  6. compare the size of the lambda.zip with one made on non-debian distribution (it's smaller, because it doesn't include the packages from your virtualenv)
  7. see how the thing fails with unmet dependencies if you deploy it
  8. see how the lambda.zip does not contain your requirements

Your Environment

  • Zappa version used: latest
  • Operating System and Python version: Amazon Linux AMI
  • The output of pip freeze: any
  • Link to your project (optional): N/A
  • Your zappa_settings.py: N/A (I think)

Contributor guide