Incubator-superset: flask.cli.NoAppException on fresh installation of superset via docker

Created on 16 Dec 2018  Â·  11Comments  Â·  Source: apache/incubator-superset

I'm trying to install superset using docker and followed the instructions mentioned in installation.rst
After running docker-compose up and opening http://localhost:8088 I'm getting following error.

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 95, in find_best_app
    module=module.__name__
flask.cli.NoAppException: Failed to find Flask application or factory in module "app". Use "FLASK_APP=app:name to specify one.

Issue #6505 looks similar and installing python-dotenv resolved the issue for it.
I checked the requirements-dev.txt file and it mentions python-dotenv and I assume same has been installed.
I'm not very familiar with docker and not sure how to proceed.

Thanks

image

Most helpful comment

@sushan-upadhyay , @krdeepak
Are you guys sure you rebuilt docker without a cache and not just pop it up from docker images?
sudo docker-compose build --no-cache superset - should do the job, but to be 100% sure do also
try docker rm on the container, docker rmi on the image

All 11 comments

i have the same question, please keep me informed when u fixed this THX @sushan-upadhyay

image

Same here. Clean installation on Ubuntu-16.04. From the console logs it looks like this:

superset_1  | 127.0.0.1 - - [17/Dec/2018 12:59:29] "GET /health HTTP/1.1" 500 -
superset_1  | Traceback (most recent call last):
superset_1  |   File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 330, in __call__
superset_1  |     rv = self._load_unlocked()
superset_1  |   File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 317, in _load_unlocked
superset_1  |     self._app = rv = self.loader()
superset_1  |   File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 384, in load_app
superset_1  |     'Could not locate a Flask application. You did not provide '
superset_1  | flask.cli.NoAppException: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable, and a "wsgi.py" or "app.py" module was not found in the current directory.

+1

add follow CODE to docker-entrypoint.sh within development statement

export FLASK_APP=superset                                                                                                                                
export FLASK_ENV=development  

like this

elif [ "$SUPERSET_ENV" = "development" ]; then                                                                                                               

    superset worker &                                                                                                                                        │superset_1  | 2018-12-17 14:52:24,409:INFO:werkzeug:30.30.78.136 - - [17/Dec/2018 14:52:24] "GET /static/appbuilder/js/ab.js HTTP/1.1" 200 -
    # needed by superset runserver                                                                                                                           │superset_1  | 30.30.78.136 - - [17/Dec/2018 14:52:24] "GET /static/assets/dist/preamble.f45ca008.entry.js HTTP/1.1" 200 -
    (cd superset/assets/ && yarn && yarn run sync-backend)                                                                                                   │superset_1  | 2018-12-17 14:52:24,420:INFO:werkzeug:30.30.78.136 - - [17/Dec/2018 14:52:24] "GET /static/assets/dist/preamble.f45ca008.entry.js HTTP/1.1" 200
    (cd superset/assets/ && yarn run dev) &                                                                                                                  │-
    export FLASK_APP=superset                                                                                                                                │superset_1  | 30.30.78.136 - - [17/Dec/2018 14:52:28] "POST /login/ HTTP/1.1" 302 -
    export FLASK_ENV=development                                                                                                                             │superset_1  | 2018-12-17 14:52:28,627:INFO:werkzeug:30.30.78.136 - - [17/Dec/2018 14:52:28] "POST /login/ HTTP/1.1" 302 -
    flask run -p 8088 --with-threads --reload --debugger --host=0.0.0.0

this worked for me~

Here's a solution that will work for the aforementioned problem: (https://github.com/apache/incubator-superset/pull/6547/commits/465e490a654d6e01838100994951925a29888f0a)

I specified the version and that solved the problem.

@lhyundeadsoul, Thank you that works for me also!

@MarcusSorealheis, didn't solve it for my case

contrib/docker$ sudo docker-compose build --no-cache superset
...
Collecting python-dotenv==0.10.1 (from -r requirements-dev.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/8c/14/501508b016e7b1ad0eb91bba581e66ad9bfc7c66fcacbb580eaf9bc38458/python_dotenv-0.10.1-py2.py3-none-any.whl
...
superset_1  | Traceback (most recent call last):
superset_1  |   File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 330, in __call__
superset_1  |     rv = self._load_unlocked()
superset_1  |   File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 317, in _load_unlocked
superset_1  |     self._app = rv = self.loader()
superset_1  |   File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 384, in load_app
superset_1  |     'Could not locate a Flask application. You did not provide '
superset_1  | flask.cli.NoAppException: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable, and a "wsgi.py" or "app.py" module was not found in the current directory.

@kiryaka ahhh. it appears that it only worked for non-docker flask.cli failures.

@lhyundeadsoul I added the two lines and ran the command docker-compose up. Still I'm getting the error.
Do I need to again run some installation steps ?

In fact there's a new error also.
Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 95, in find_best_app module=module.__name__ flask.cli.NoAppException: Failed to find Flask application or factory in module "app". Use "FLASK_APP=app:name to specify one.

My docker-entrypoint.sh file looks something like this

#!/bin/bash
set -ex

if [ "$#" -ne 0 ]; then
    exec "$@"
elif [ "$SUPERSET_ENV" = "development" ]; then
    superset worker &
    # needed by superset runserver
    (cd superset/assets/ && yarn && yarn run sync-backend)
    (cd superset/assets/ && yarn run dev) &
    export FLASK_APP=superset
    export FLASK_ENV=development
    flask run -p 8088 --with-threads --reload --debugger --host=0.0.0.0
elif [ "$SUPERSET_ENV" = "production" ]; then
    superset worker &
    superset runserver -a 0.0.0.0 -w $((2 * $(getconf _NPROCESSORS_ONLN) + 1))
else
    superset --help
fi

Same problem here, docker based installation.

@sushan-upadhyay , @krdeepak
Are you guys sure you rebuilt docker without a cache and not just pop it up from docker images?
sudo docker-compose build --no-cache superset - should do the job, but to be 100% sure do also
try docker rm on the container, docker rmi on the image

@kiryaka
sudo docker-compose build --no-cache superset did the trick.
Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gbrian picture gbrian  Â·  3Comments

gbrian picture gbrian  Â·  3Comments

ghost picture ghost  Â·  3Comments

josephtyler picture josephtyler  Â·  3Comments

eliab picture eliab  Â·  3Comments