4

I have migrated my python project from 2.7 to 3.8. and I am trying to deploy using zappa. But, as soon as it's starting updating Lambda function configs it hits this error.

Updating Lambda function configuration..
Oh no! An error occurred! :(

==============

Traceback (most recent call last):
  File "/Users/leilakarimi/Projects/ATGWSams/venv/lib/python3.7/site-packages/zappa/cli.py", line 3422, in handle
    sys.exit(cli.handle())
  File "/Users/leilakarimi/Projects/ATGWSams/venv/lib/python3.7/site-packages/zappa/cli.py", line 588, in handle
    self.dispatch_command(self.command, stage)
  File "/Users/leilakarimi/Projects/ATGWSams/venv/lib/python3.7/site-packages/zappa/cli.py", line 644, in dispatch_command
    self.vargs["docker_image_uri"],
  File "/Users/leilakarimi/Projects/ATGWSams/venv/lib/python3.7/site-packages/zappa/cli.py", line 1194, in update
    endpoint_configuration=self.endpoint_configuration,
  File "/Users/leilakarimi/Projects/ATGWSams/venv/lib/python3.7/site-packages/zappa/core.py", line 2417, in create_stack_template
    self.cf_template.add_description("Automatically generated with Zappa")
AttributeError: 'Template' object has no attribute 'add_description'

I found this question and tried to downgrade troposphere as suggested in this post but again I face a new error as below:

   ERROR: Command errored out with exit status 1:
     command: /Users/leilakarimi/Projects/ATGWSams/venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/2q/m5qvgtkj1872r4695zkbpln80000gn/T/pip-install-w9uojyvq/troposphere_527f0b9692da4c9ca1d6451190752408/setup.py'"'"'; __file__='"'"'/private/var/folders/2q/m5qvgtkj1872r4695zkbpln80000gn/T/pip-install-w9uojyvq/troposphere_527f0b9692da4c9ca1d6451190752408/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/2q/m5qvgtkj1872r4695zkbpln80000gn/T/pip-pip-egg-info-hguo5f3y
         cwd: /private/var/folders/2q/m5qvgtkj1872r4695zkbpln80000gn/T/pip-install-w9uojyvq/troposphere_527f0b9692da4c9ca1d6451190752408/
    Complete output (1 lines):
    error in troposphere setup command: use_2to3 is invalid.
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/35/a1/cfb1f6b2f271213da05fd5c67cda0256d7d841ba0edbfa815ae517c6235d/troposphere-2.2.0.tar.gz#sha256=b2e322063e2278e7d69822943d230b683ce9a0438db8ad017f610d344998453d (from https://pypi.org/simple/troposphere/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement troposphere==2.7.1 (from versions: 0.1.2, 0.2.0, 0.3.0, 0.3.2, 0.3.3, 0.3.4, 0.4.0, 0.5.0, 0.6.0, 0.6.1, 0.6.2, 0.7.0, 0.7.1, 0.7.2, 1.0.0, 1.1.0, 1.1.1, 1.1.2, 1.2.0, 1.2.1, 1.2.2, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.9.5, 1.9.6, 2.0.0, 2.0.1, 2.0.2, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 2.4.9, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.7.0, 2.7.1, 3.0.0, 3.0.1, 3.0.2, 3.0.3)
ERROR: No matching distribution found for troposphere==2.7.1

Any thoughts/help is much appreciated. thanks

Leila
  • 232
  • 6
  • 15
  • 1
    unfortunately, no! as I mentioned in the post when I tried their solution it throws the second error – Leila Sep 20 '21 at 02:13
  • Hey! Have you also updated your zappa version? – Brian Destura Sep 20 '21 at 02:17
  • yes I did... it was 0.48.2 and now is 0.53.0 – Leila Sep 20 '21 at 02:26
  • That's strange. 0.53.0 uses [troposphere 3.0.2](https://github.com/zappa/Zappa/compare/0.53.0...master#diff-4d7c51b1efe9043e44439a949dfd92e5827321b34082903477fd04876edb7552R77). Try to remove your explicit entry for `troposphere==2.7.1` and reinstall all packages and see if it works – Brian Destura Sep 20 '21 at 02:29
  • no it didn;t. got back to first error message about template add_description ! :( – Leila Sep 20 '21 at 02:45
  • Sorry I was wrong. The link I gave was the diff between master and 0.53.0. This means that the fix will be in the next version which is not yet released – Brian Destura Sep 20 '21 at 02:50
  • 1
    all good downgraded zappa to 0.48.2 which was my previous working version and thankfully it's working with python 3.8.Thanks for your help – Leila Sep 20 '21 at 04:31

2 Answers2

7

setuptools 58 broke support for use_2to3. Therefore, you should add setuptools<58 to your requirements file along with troposphere<3. If you still get the same issue, downgrade setuptools first and then install troposphere with the other requirements.

Related question: Error while downloading the requirements using pip install (setup command: use_2to3 is invalid.)

nbeuchat
  • 6,575
  • 5
  • 36
  • 50
0

We have forked zappa and removed the pinned requirement for Werkzeug. Zappa project been restarted but they have been late to update. You can read how to do this at this blog

Nikhil S
  • 1,179
  • 1
  • 9
  • 19