Forums

ImportError: No module named flask_migrate

I installed flask-migrate but when i try to run my web app i get error.

2017-07-21 17:59:45,763: Error running WSGI application
2017-07-21 17:59:45,769: ImportError: No module named flask_migrate
2017-07-21 17:59:45,769:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 88, in <module>
2017-07-21 17:59:45,770:     from run import app as application
2017-07-21 17:59:45,770: 
2017-07-21 17:59:45,770:   File "/home/nairamanager/nairamanager_flask/run.py", line 4, in <module>
2017-07-21 17:59:45,770:     from app import app
2017-07-21 17:59:45,770: 
2017-07-21 17:59:45,771:   File "/home/nairamanager/nairamanager_flask/app/__init__.py", line 6, in <module>
2017-07-21 17:59:45,771:     from flask_migrate import Migrate, MigrateCommand
2017-07-21 17:59:45,771: ***************************************************
2017-07-21 17:59:45,771: If you're seeing an import error and don't know why,
2017-07-21 17:59:45,771: we have a dedicated help page to help you debug: 
2017-07-21 17:59:45,772: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-21 17:59:45,772: ***************************************************
2017-07-21 18:00:07,578: Error running WSGI application
2017-07-21 18:00:07,579: ImportError: No module named flask_migrate
2017-07-21 18:00:07,580:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 88, in <module>
2017-07-21 18:00:07,580:     from run import app as application
2017-07-21 18:00:07,580: 
2017-07-21 18:00:07,580:   File "/home/nairamanager/nairamanager_flask/run.py", line 4, in <module>
2017-07-21 18:00:07,580:     from app import app
2017-07-21 18:00:07,580: 
2017-07-21 18:00:07,580:   File "/home/nairamanager/nairamanager_flask/app/__init__.py", line 6, in <module>
2017-07-21 18:00:07,580:     from flask_migrate import Migrate, MigrateCommand
2017-07-21 18:00:07,581: ***************************************************
2017-07-21 18:00:07,581: If you're seeing an import error and don't know why,
2017-07-21 18:00:07,581: we have a dedicated help page to help you debug: 
2017-07-21 18:00:07,581: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-21 18:00:07,581: ***************************************************
2017-07-21 18:00:39,439: Error running WSGI application
2017-07-21 18:00:39,441: ImportError: No module named flask_migrate
2017-07-21 18:00:39,441:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 88, in <module>
2017-07-21 18:00:39,441:     from run import app as application
2017-07-21 18:00:39,441: 
2017-07-21 18:00:39,441:   File "/home/nairamanager/nairamanager_flask/run.py", line 4, in <module>
2017-07-21 18:00:39,442:     from app import app
2017-07-21 18:00:39,442: 
2017-07-21 18:00:39,442:   File "/home/nairamanager/nairamanager_flask/app/__init__.py", line 6, in <module>
2017-07-21 18:00:39,442:     from flask_migrate import Migrate, MigrateCommand
2017-07-21 18:00:39,442: ***************************************************
2017-07-21 18:00:39,443: If you're seeing an import error and don't know why,
2017-07-21 18:00:39,443: we have a dedicated help page to help you debug: 
2017-07-21 18:00:39,443: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-21 18:00:39,443: ***************************************************
2017-07-21 18:00:39,981: Error running WSGI application
2017-07-21 18:00:39,981: ImportError: No module named flask_migrate
2017-07-21 18:00:39,981:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 88, in <module>
2017-07-21 18:00:39,982:     from run import app as application
2017-07-21 18:00:39,982: 
2017-07-21 18:00:39,982:   File "/home/nairamanager/nairamanager_flask/run.py", line 4, in <module>
2017-07-21 18:00:39,982:     from app import app
2017-07-21 18:00:39,982: 
2017-07-21 18:00:39,982:   File "/home/nairamanager/nairamanager_flask/app/__init__.py", line 6, in <module>
2017-07-21 18:00:39,982:     from flask_migrate import Migrate, MigrateCommand
2017-07-21 18:00:39,983: ***************************************************
2017-07-21 18:00:39,983: If you're seeing an import error and don't know why,
2017-07-21 18:00:39,983: we have a dedicated help page to help you debug: 
2017-07-21 18:00:39,983: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-21 18:00:39,983: ***************************************************
2017-07-21 18:18:32,300: Error running WSGI application
2017-07-21 18:18:32,327: ImportError: No module named flask_migrate
2017-07-21 18:18:32,328:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 88, in <module>
2017-07-21 18:18:32,328:     ## is used externally.
2017-07-21 18:18:32,328: 
2017-07-21 18:18:32,328:   File "/home/nairamanager/nairamanager_flask/run.py", line 4, in <module>
2017-07-21 18:18:32,328:     from app import app
2017-07-21 18:18:32,328: 
2017-07-21 18:18:32,328:   File "/home/nairamanager/nairamanager_flask/app/__init__.py", line 6, in <module>
2017-07-21 18:18:32,328:     from flask_migrate import Migrate, MigrateCommand
2017-07-21 18:18:32,329: ***************************************************
2017-07-21 18:18:32,329: If you're seeing an import error and don't know why,
2017-07-21 18:18:32,329: we have a dedicated help page to help you debug: 
2017-07-21 18:18:32,329: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-21 18:18:32,329: ***************************************************
2017-07-21 18:18:47,324: Error running WSGI application
2017-07-21 18:18:47,326: ImportError: No module named flask_migrate
2017-07-21 18:18:47,327:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 89, in <module>
2017-07-21 18:18:47,327:     from run import app as application
2017-07-21 18:18:47,327: 
2017-07-21 18:18:47,327:   File "/home/nairamanager/nairamanager_flask/run.py", line 4, in <module>
2017-07-21 18:18:47,327:     from app import app
2017-07-21 18:18:47,328: 
2017-07-21 18:18:47,328:   File "/home/nairamanager/nairamanager_flask/app/__init__.py", line 6, in <module>
2017-07-21 18:18:47,328:     from flask_migrate import Migrate, MigrateCommand
2017-07-21 18:18:47,328: ***************************************************
2017-07-21 18:18:47,328: If you're seeing an import error and don't know why,
2017-07-21 18:18:47,329: we have a dedicated help page to help you debug: 
2017-07-21 18:18:47,329: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-21 18:18:47,329: ***************************************************
2017-07-21 18:18:47,913: Error running WSGI application
2017-07-21 18:18:47,914: ImportError: No module named flask_migrate
2017-07-21 18:18:47,914:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 89, in <module>
2017-07-21 18:18:47,914:     from run import app as application
2017-07-21 18:18:47,914: 
2017-07-21 18:18:47,915:   File "/home/nairamanager/nairamanager_flask/run.py", line 4, in <module>
2017-07-21 18:18:47,915:     from app import app
2017-07-21 18:18:47,915: 
2017-07-21 18:18:47,915:   File "/home/nairamanager/nairamanager_flask/app/__init__.py", line 6, in <module>
2017-07-21 18:18:47,915:     from flask_migrate import Migrate, MigrateCommand
2017-07-21 18:18:47,915: ***************************************************
2017-07-21 18:18:47,915: If you're seeing an import error and don't know why,
2017-07-21 18:18:47,915: we have a dedicated help page to help you debug: 
2017-07-21 18:18:47,916: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-21 18:18:47,916: ***************************************************
2017-07-21 18:32:16,612: Error running WSGI application
2017-07-21 18:32:16,664: ImportError: No module named flask_migrate
2017-07-21 18:32:16,664:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 88, in <module>
2017-07-21 18:32:16,664:     from run import app as application
2017-07-21 18:32:16,664: 
2017-07-21 18:32:16,664:   File "/home/nairamanager/nairamanager_flask/run.py", line 4, in <module>
2017-07-21 18:32:16,664:     from app import app
2017-07-21 18:32:16,665: 
2017-07-21 18:32:16,665:   File "/home/nairamanager/nairamanager_flask/app/__init__.py", line 6, in <module>
2017-07-21 18:32:16,665:     from flask_migrate import Migrate, MigrateCommand
2017-07-21 18:32:16,665: ***************************************************
2017-07-21 18:32:16,665: If you're seeing an import error and don't know why,
2017-07-21 18:32:16,665: we have a dedicated help page to help you debug: 
2017-07-21 18:32:16,666: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-21 18:32:16,666: ***************************************************
2017-07-21 18:45:58,779: Error running WSGI application
2017-07-21 18:45:58,809:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 88
2017-07-21 18:45:58,809: 
2017-07-21 18:45:58,809:     from run import app as application
2017-07-21 18:45:58,809: 
2017-07-21 18:45:58,809:        ^
2017-07-21 18:45:58,809: 
2017-07-21 18:45:58,810: IndentationError: expected an indented block
2017-07-21 18:45:58,810: ***************************************************
2017-07-21 18:45:58,810: If you're seeing an import error and don't know why,
2017-07-21 18:45:58,810: we have a dedicated help page to help you debug: 
2017-07-21 18:45:58,810: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-21 18:45:58,811: ***************************************************
2017-07-21 18:48:01,793: Error running WSGI application
2017-07-21 18:48:01,794:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 88
2017-07-21 18:48:01,794: 
2017-07-21 18:48:01,794:     from run import app as application
2017-07-21 18:48:01,794: 
2017-07-21 18:48:01,794:        ^
2017-07-21 18:48:01,795: 
2017-07-21 18:48:01,795: IndentationError: expected an indented block
2017-07-21 18:48:01,795: ***************************************************
2017-07-21 18:48:01,795: If you're seeing an import error and don't know why,
2017-07-21 18:48:01,795: we have a dedicated help page to help you debug: 
2017-07-21 18:48:01,795: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-21 18:48:01,796: ***************************************************
2017-07-21 18:55:37,664: Error running WSGI application
2017-07-21 18:55:37,666:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 88
2017-07-21 18:55:37,667: 
2017-07-21 18:55:37,667:     from run import app as application
2017-07-21 18:55:37,667: 
2017-07-21 18:55:37,667:        ^
2017-07-21 18:55:37,667: 
2017-07-21 18:55:37,668: IndentationError: expected an indented block
2017-07-21 18:55:37,668: ***************************************************
2017-07-21 18:55:37,668: If you're seeing an import error and don't know why,
2017-07-21 18:55:37,668: we have a dedicated help page to help you debug: 
2017-07-21 18:55:37,668: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-21 18:55:37,668: ***************************************************
2017-07-21 18:55:53,760: Error running WSGI application
2017-07-21 18:55:53,761:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 88
2017-07-21 18:55:53,761: 
2017-07-21 18:55:53,761:     from run import app as application
2017-07-21 18:55:53,761: 
2017-07-21 18:55:53,761:        ^
2017-07-21 18:55:53,762: 
2017-07-21 18:55:53,762: IndentationError: expected an indented block
2017-07-21 18:55:53,762: ***************************************************
2017-07-21 18:55:53,762: If you're seeing an import error and don't know why,
2017-07-21 18:55:53,762: we have a dedicated help page to help you debug: 
2017-07-21 18:55:53,763: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-21 18:55:53,763: ***************************************************
2017-07-25 12:48:36,599: Error running WSGI application
2017-07-25 12:48:36,599:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 88
2017-07-25 12:48:36,600: 
2017-07-25 12:48:36,600:     from run import app as application
2017-07-25 12:48:36,600: 
2017-07-25 12:48:36,600:        ^
2017-07-25 12:48:36,600: 
2017-07-25 12:48:36,600: IndentationError: expected an indented block
2017-07-25 12:48:36,601: ***************************************************
2017-07-25 12:48:36,601: If you're seeing an import error and don't know why,
2017-07-25 12:48:36,601: we have a dedicated help page to help you debug: 
2017-07-25 12:48:36,601: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-25 12:48:36,601: ***************************************************
2017-07-25 12:48:48,384: Error running WSGI application
2017-07-25 12:48:48,385:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 88
2017-07-25 12:48:48,385: 
2017-07-25 12:48:48,385:     from run import app as application
2017-07-25 12:48:48,385: 
2017-07-25 12:48:48,385:        ^
2017-07-25 12:48:48,386: 
2017-07-25 12:48:48,386: IndentationError: expected an indented block
2017-07-25 12:48:48,386: ***************************************************
2017-07-25 12:48:48,386: If you're seeing an import error and don't know why,
2017-07-25 12:48:48,386: we have a dedicated help page to help you debug: 
2017-07-25 12:48:48,387: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-25 12:48:48,387: ***************************************************
2017-07-25 13:08:47,449: Error running WSGI application
2017-07-25 13:08:47,450:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 88
2017-07-25 13:08:47,450: 
2017-07-25 13:08:47,450:     from run import app as application
2017-07-25 13:08:47,450: 
2017-07-25 13:08:47,450:        ^
2017-07-25 13:08:47,450: 
2017-07-25 13:08:47,450: IndentationError: expected an indented block
2017-07-25 13:08:47,450: ***************************************************
2017-07-25 13:08:47,450: If you're seeing an import error and don't know why,
2017-07-25 13:08:47,451: we have a dedicated help page to help you debug: 
2017-07-25 13:08:47,451: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-25 13:08:47,451: ***************************************************
2017-07-25 13:08:48,742: Error running WSGI application
2017-07-25 13:08:48,743:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 88
2017-07-25 13:08:48,743: 
2017-07-25 13:08:48,743:     from run import app as application
2017-07-25 13:08:48,743: 
2017-07-25 13:08:48,743:        ^
2017-07-25 13:08:48,743: 
2017-07-25 13:08:48,743: IndentationError: expected an indented block
2017-07-25 13:08:48,743: ***************************************************
2017-07-25 13:08:48,744: If you're seeing an import error and don't know why,
2017-07-25 13:08:48,744: we have a dedicated help page to help you debug: 
2017-07-25 13:08:48,744: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-25 13:08:48,744: ***************************************************
2017-07-25 14:14:50,293: Error running WSGI application
2017-07-25 14:14:50,306: ImportError: No module named flask_sqlalchemy
2017-07-25 14:14:50,306:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 119, in <module>
2017-07-25 14:14:50,306:     from run import app as application
2017-07-25 14:14:50,306: 
2017-07-25 14:14:50,306:   File "/home/nairamanager/nairamanager_flask/run.py", line 4, in <module>
2017-07-25 14:14:50,307:     from app import app
2017-07-25 14:14:50,307: 
2017-07-25 14:14:50,307:   File "/home/nairamanager/nairamanager_flask/app/__init__.py", line 4, in <module>
2017-07-25 14:14:50,307:     from flask_sqlalchemy import SQLAlchemy
2017-07-25 14:14:50,307: ***************************************************
2017-07-25 14:14:50,308: If you're seeing an import error and don't know why,
2017-07-25 14:14:50,308: we have a dedicated help page to help you debug: 
2017-07-25 14:14:50,308: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-25 14:14:50,308: ***************************************************
2017-07-25 14:15:19,609: Error running WSGI application
2017-07-25 14:15:19,612: ImportError: No module named flask_sqlalchemy
2017-07-25 14:15:19,612:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 119, in <module>
2017-07-25 14:15:19,612:     from run import app as application
2017-07-25 14:15:19,612: 
2017-07-25 14:15:19,612:   File "/home/nairamanager/nairamanager_flask/run.py", line 4, in <module>
2017-07-25 14:15:19,612:     from app import app
2017-07-25 14:15:19,613: 
2017-07-25 14:15:19,613:   File "/home/nairamanager/nairamanager_flask/app/__init__.py", line 4, in <module>
2017-07-25 14:15:19,613:     from flask_sqlalchemy import SQLAlchemy
2017-07-25 14:15:19,613: ***************************************************
2017-07-25 14:15:19,613: If you're seeing an import error and don't know why,
2017-07-25 14:15:19,613: we have a dedicated help page to help you debug: 
2017-07-25 14:15:19,613: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-25 14:15:19,613: ***************************************************
2017-07-25 14:15:21,504: Error running WSGI application
2017-07-25 14:15:21,504: ImportError: No module named flask_sqlalchemy
2017-07-25 14:15:21,504:   File "/var/www/nairamanager_pythonanywhere_com_wsgi.py", line 119, in <module>
2017-07-25 14:15:21,504:     from run import app as application
2017-07-25 14:15:21,504: 
2017-07-25 14:15:21,505:   File "/home/nairamanager/nairamanager_flask/run.py", line 4, in <module>
2017-07-25 14:15:21,505:     from app import app
2017-07-25 14:15:21,505: 
2017-07-25 14:15:21,505:   File "/home/nairamanager/nairamanager_flask/app/__init__.py", line 4, in <module>
2017-07-25 14:15:21,505:     from flask_sqlalchemy import SQLAlchemy
2017-07-25 14:15:21,505: ***************************************************
2017-07-25 14:15:21,506: If you're seeing an import error and don't know why,
2017-07-25 14:15:21,506: we have a dedicated help page to help you debug: 
2017-07-25 14:15:21,506: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-07-25 14:15:21,506: ***************************************************

Please why is this and how do i resolve it?

[edit by admin: formatting]

There's a link in the traceback that leads to a page that tells you how to debug import errors. Follow it and work through the process there.

Doesn't work.

if i use the bash console to run my app(python /path/to/this/file/run.py) it runs with no errors but when i try to access my webapp(nairamanager.pythonanywhere.com) i still get that error.

that's probably because it's running from different working directories

Also -- I see your site is running in a virtualenv. Have you reloaded the app since you installed flask_sqlalchemy into the env?

@conrad How is that?

@giles Yes, i did, Multiple times.

When you run your app in a console are you running it from the virtualenv that your web app is configured to use?

Issue solved thanks everyone.