Importing Flask.Ext Raises Modulenotfounderror

ImportError: No module named 'flask.ext'

The "flask.ext" style of naming/importing modules has been deprecated since 2016. Here's the reasoning. You should use the first style you described instead:

# Use this import format
from flask_sqlalchemy import SQLAlchemy

As for the suggestion that you install your flask packages globally, this somewhat defeats the purpose of using a venv in the first place. It makes it impossible to use pip freeze --local > requirements.txt to only save relevant packages, opening you up to package version conflicts.

Why am I getting No module named 'flask.ext' with Flask-Autodoc?

import flask.ext.whatever is no longer supported in Flask 1.0. Flask-Autodoc's docs need to be updated. flask_autodoc should be imported directly:

from flask_autodoc import Autodoc

ImportError: No module named flask.ext.uploads

Install flask uploads module

pip install flask-uploads

from flask_uploads import UploadSet, configure_uploads

How to solve flask.ext error

Instead of flask.ext use flask_:

from flask_misaka import Misaka

ImportError: No module named flask.ext.mysql

It seems like a virtualenv config problem
you should get rid of old virtualenv and make a new one like this

virtualenv yournewvirtualenv --python=/usr/bin/python3.4

This is the link I referenced:
https://www.pythonanywhere.com/forums/topic/2877/

ImportError: No module named flask.ext.restless

You can try reinstalling pip install --upgrade --force-reinstall flask_restless

If that does not work:

install flask_restless 0.14-dev from github.

git clone https://github.com/jfinkels/flask-restless

cd flask-restless
pip install -r requirements-doc.txt

Use import flask_restless

   flask_restless.__version__
'0.13.1'

to make sure python is seeing the correct version of flask_restless.

You also seem to have a "flask" dir in your path:

'/home/ian/git_dev/flask_rest/test2/flask/local/lib/python2.7/site-packages/flask/exthook.py'

that may be conflicting with your imports.



Related Topics



Leave a reply



Submit