Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'Template' object has no attribute 'add_description' #1000

Closed
MayaraMacielMatos opened this issue Jul 6, 2021 · 23 comments
Closed

Comments

@MayaraMacielMatos
Copy link

MayaraMacielMatos commented Jul 6, 2021

Error deploy

self.cf_template.add_description("Automatically generated with Zappa")
AttributeError: 'Template' object has no attribute 'add_description'

@mikedklein
Copy link

mikedklein commented Jul 6, 2021

Troposphere updated add_description toset_description along with other previously deprecated template methods. https://github.com/cloudtools/troposphere/blob/23aafdce2a7780d0e1b24700648dddd6f8d2b04b/CHANGELOG.rst#300-20210705

I think it would be as easy as updating this line to set_description once I get a workaround for the build I will try to put a PR in.

What I don't understand is why the version isn't being locked per the generated requirements.txt file. It should be locked at 2.7.0.

@mikedklein
Copy link

If you froze your requirements prior to the 3.0.0 troposphere release you should be fine. If not just add troposphere==2.7.0 to your requirements.txt to make sure to lock the version in and that should solve the issue for now.

@mikedklein
Copy link

mikedklein commented Jul 6, 2021

@MayaraMacielMatos I am not sure closing this is the best. If a user today decided to use Zappa after the troposphere 3.0.0 release this could happen when they install all their dependencies.

@MayaraMacielMatos
Copy link
Author

MayaraMacielMatos commented Jul 6, 2021

@mikedklein I appreciate the help, I'll keep it open

@adosaa
Copy link

adosaa commented Jul 7, 2021

Same issue here using ci/cd aws code build...partially solved using hardcoded version of troposphere==2.7.1

@mikedklein
Copy link

Looks like there is a related issue and subsequent PR we can probably safely close this issue @MayaraMacielMatos

@mapattacker
Copy link

hope it can be resolved soon since this is a simple bug to fix. thanks for pointing the resolution @mikedklein

@tongclement
Copy link

+1

@tongclement
Copy link

Thanks for the prompt response and help. I changed the code to 'set_response' myself and everything is resolved.

@DPS0340
Copy link
Contributor

DPS0340 commented Jul 13, 2021

For pipenv users, edit Pipfile like:

[packages]
troposphere = { version = "<3.0", ignore = ["zappa"] }
zappa = "*"

@ian-whitestone
Copy link
Contributor

What I don't understand is why the version isn't being locked per the generated requirements.txt file. It should be locked at 2.7.0.

I was also very confused by this @mikedklein , but it looks like the setup.py relies on the requirements.in, not the requirements.txt

https://github.com/zappa/Zappa/blob/master/setup.py#L10-L21

import os
import sys
from setuptools import setup
from io import open
from zappa import __version__

with open('README.md') as readme_file:
    long_description = readme_file.read()

with open(os.path.join(os.path.dirname(__file__), 'requirements.in')) as f:
    required = f.read().splitlines()

with open(os.path.join(os.path.dirname(__file__), 'test_requirements.in')) as f:
    test_required = f.read().splitlines()

setup(
    name='zappa',
    version=__version__,
    packages=['zappa'],
    install_requires=required,
    tests_require=test_required,
    test_suite='nose.collector',
    include_package_data=True,
    license='MIT License',
    description='Server-less Python Web Services for AWS Lambda and API Gateway',
    long_description=long_description,
    long_description_content_type='text/markdown',
    url='https://github.com/zappa/Zappa',
    author='Rich Jones',
    author_email='[email protected]',
    entry_points={
        'console_scripts': [
            'zappa=zappa.cli:handle',
            'z=zappa.cli:handle',
        ]
    },

And in requirements.in it doesn't specify a version for troposphere:

argcomplete
boto3>=1.17.28
durationpy
hjson
jmespath
kappa==0.6.0
pip>=9.0.1
python-dateutil
python-slugify
PyYAML
future
# previous version don't work with urllib3 1.24
requests>=2.20.0
six
toml
tqdm
troposphere
# See https://github.com/Miserlou/Zappa/issues/2036
Werkzeug<1.0
wheel
wsgi-request-logger
pip-tools

@jneves @mcrowson i wonder if there's an opportunity to get rid of the requirements.txt and just rely on requirements.in to avoid this confusion? Or alternatively update setup.py to rely on requirements.txt instead?

@clown-0726
Copy link

Still get this issue.

@clown-0726
Copy link

@mikedklein If I lock troposphere at 2.7.0, I will get another error which is error in troposphere setup command: use_2to3 is invalid..

How did you git rid of this or you didn't run into this issue?

@heukirne
Copy link

@clown-0726 , Try to lock troposphere at 2.7.1

@luistm
Copy link

luistm commented Oct 10, 2021

I installed from master the branch. It's a temporary measured, but solved the issue for me.

If you use pipenv, you can add or replace with this line in the [packages] section inside the Pipfile:

zappa = {editable = true, git = "https://github.com/zappa/Zappa"}

@vlayusuke
Copy link

@luistm Thank you for your advice. But still the same error reappears in my environment.

  • macOS Big Sur 11.6
  • Python: 3.8.10
  • Flask: 1.1.4
  • troposphere: 3.0.0
  • zappa: 0.53.0

@clown-0726
Copy link

@heukirne It doesn't work for me with 2.7.1 as well.

@qeternity
Copy link

Is this library still maintained? Just getting started and coming across a handful of bugs that are just seemingly stale.

@jottenlips
Copy link
Contributor

Miserlou/Zappa#2228 Looks like this PR is the fix

@vlayusuke
Copy link

@jottenlips Thanks a lot!

@ian-whitestone
Copy link
Contributor

Note, even if you pin Troposphere to 2.7.0, you'll run into a new issue that looks something like:

   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.

see https://stackoverflow.com/questions/69248426/zappa-deployment-error-troposphere-2-7-1-didnt-help-attributeerror-templat

TL,DR: you can't install troposphere 2.7 unless you also force setuptools to be <v58

The fix for this issue is already in place on the master branch of Zappa, they just need to push a new release.

@ian-whitestone
Copy link
Contributor

Miserlou/Zappa#2228 Looks like this PR is the fix

Wrong repo. As per my comment above:

The fix for this issue is already in place on the master branch of Zappa, they just need to push a new release.

@hellno
Copy link
Collaborator

hellno commented Nov 8, 2021

a new zappa version was released, including a fix for this:
https://github.com/zappa/Zappa/releases/tag/0.54.0

@hellno hellno closed this as completed Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests