Tag Archives: superset

[resolved] superset failed to create admin user: error! User already exists user or attributeerror: ‘nonetype’‘

superset failed to create admin user and reported error: error! User already exists user or attributeerror: ‘nonetype’ object has no attribute ‘auth_ Type ‘solution

Error description

After installing superset, it is found that the admin user cannot log in, execute flash Fab create admin , and the following error is reported:

(superset) [layne@hadoop102 bin]$ flask fab create-admin
Username [admin]: layne
User first name [admin]: 
User last name [user]: 
Email [[email protected]]: 
Password: 
Repeat for confirmation: 
logging was configured successfully
INFO:superset.utils.logging_configurator:logging was configured successfully
/opt/module/miniconda3/envs/superset/lib/python3.6/site-packages/flask_caching/__init__.py:202: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
  "Flask-Caching: CACHE_TYPE is set to null, "
No PIL installation found
INFO:superset.utils.screenshots:No PIL installation found
Recognized Database Authentications.
Error! User already exists layne

Execute fabmanager create admin -- app superset according to the online method, and the following error is reported:

(superset) [layne@hadoop102 bin]$ fabmanager create-admin --app superset
fabmanager is going to be deprecated in 2.2.X, you can use the same commands on the improved 'flask fab <command>'
Username [admin]: layne
User first name [admin]: 
User last name [user]: 
Email [[email protected]]:
Password: 
Repeat for confirmation: 
Traceback (most recent call last):
  File "/opt/module/miniconda3/envs/superset/bin/fabmanager", line 8, in <module>
    sys.exit(cli())
  File "/opt/module/miniconda3/envs/superset/lib/python3.6/site-packages/flask_appbuilder/console.py", line 422, in cli
    cli_app()
  File "/opt/module/miniconda3/envs/superset/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/opt/module/miniconda3/envs/superset/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/opt/module/miniconda3/envs/superset/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/module/miniconda3/envs/superset/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/module/miniconda3/envs/superset/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/opt/module/miniconda3/envs/superset/lib/python3.6/site-packages/flask_appbuilder/console.py", line 137, in create_admin
    auth_type.get(_appbuilder.sm.auth_type, "No Auth method")
AttributeError: 'NoneType' object has no attribute 'auth_type'

resolvent

Delete the superset.db database file and reinitialize the database

For example, my current Linux login user name is lane, and my superset.db file is in /home/Lane /. Superset/superset. DB , delete the file:

(superset) [layne@hadoop102 ~]$ cd /home/layne/.superset/
(superset) [layne@hadoop102 .superset]$ rm -f superset.db 

Then reinitialize the database:

(superset) [layne@hadoop102 ~]$ superset db upgrade

Create the admin user again and find that it can be created successfully:

(superset) [layne@hadoop102 ~]$ export FLASK_APP=superset
(superset) [layne@hadoop102 ~]$ flask fab create-admin
Username [admin]: layne
User first name [admin]: 
User last name [user]: 
Email [[email protected]]: 
Password: 
Repeat for confirmation: 
logging was configured successfully
INFO:superset.utils.logging_configurator:logging was configured successfully
/opt/module/miniconda3/envs/superset/lib/python3.6/site-packages/flask_caching/__init__.py:202: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
  "Flask-Caching: CACHE_TYPE is set to null, "
No PIL installation found
INFO:superset.utils.screenshots:No PIL installation found
Recognized Database Authentications.
Admin User layne created.

OK, it’s done!