记录windows 10 环境下安装superset 的一个坑

环境

  • win10, python 3.6, conda envs

一个坑

报错信息:

Traceback (most recent call last):
  File "C:\Anaconda3\envs\superset\lib\site-packages\flask\app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Anaconda3\envs\superset\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Anaconda3\envs\superset\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Anaconda3\envs\superset\lib\site-packages\flask\_compat.py", line 33, in reraise
    raise value
  File "C:\Anaconda3\envs\superset\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Anaconda3\envs\superset\lib\site-packages\flask\app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Anaconda3\envs\superset\lib\site-packages\superset\views\core.py", line 2768, in welcome
    .filter_by(user_id=g.user.get_id())
  File "C:\Anaconda3\envs\superset\lib\site-packages\sqlalchemy\orm\query.py", line 3305, in scalar
    ret = self.one()
  File "C:\Anaconda3\envs\superset\lib\site-packages\sqlalchemy\orm\query.py", line 3275, in one
    ret = self.one_or_none()
  File "C:\Anaconda3\envs\superset\lib\site-packages\sqlalchemy\orm\query.py", line 3244, in one_or_none
    ret = list(self)
  File "C:\Anaconda3\envs\superset\lib\site-packages\sqlalchemy\orm\query.py", line 3317, in __iter__
    return self._execute_and_instances(context)
  File "C:\Anaconda3\envs\superset\lib\site-packages\sqlalchemy\orm\query.py", line 3342, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "C:\Anaconda3\envs\superset\lib\site-packages\sqlalchemy\engine\base.py", line 988, in execute
    return meth(self, multiparams, params)
  File "C:\Anaconda3\envs\superset\lib\site-packages\sqlalchemy\sql\elements.py", line 287, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "C:\Anaconda3\envs\superset\lib\site-packages\sqlalchemy\engine\base.py", line 1107, in _execute_clauseelement
    distilled_params,
  File "C:\Anaconda3\envs\superset\lib\site-packages\sqlalchemy\engine\base.py", line 1248, in _execute_context
    e, statement, parameters, cursor, context
  File "C:\Anaconda3\envs\superset\lib\site-packages\sqlalchemy\engine\base.py", line 1466, in _handle_dbapi_exception
    util.raise_from_cause(sqlalchemy_exception, exc_info)
  File "C:\Anaconda3\envs\superset\lib\site-packages\sqlalchemy\util\compat.py", line 383, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "C:\Anaconda3\envs\superset\lib\site-packages\sqlalchemy\util\compat.py", line 128, in reraise
    raise value.with_traceback(tb)
  File "C:\Anaconda3\envs\superset\lib\site-packages\sqlalchemy\engine\base.py", line 1244, in _execute_context
    cursor, statement, parameters, context
  File "C:\Anaconda3\envs\superset\lib\site-packages\sqlalchemy\engine\default.py", line 552, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: user_attribute
[SQL: SELECT user_attribute.welcome_dashboard_id AS user_attribute_welcome_dashboard_id
FROM user_attribute
WHERE user_attribute.user_id = ?]
[parameters: ('1',)]
(Background on this error at: http://sqlalche.me/e/e3q8)

处理

改了config.py文件中SQLALCHEMY_DATABASE_URI = ‘sqlite:///superset.db’ ,然后发现superset的文件在路径"xxx\superset\Lib\site-packages\superset"下面了,而不是在bin里面,所以我就把命令行的路径退一级,到superset下面,然后在该路径下重新执行一遍就ok了。

# 创建管理员账号
fabmanager create-admin --app superset 

# 初始化数据库
python superset db upgrade

# 载入案例数据
python superset load_examples

# 初始化角色和权限
python superset init

# 启动服务,端口号 8088,使用 -p 更改端口号
python superset runserver -d

参考

https://www.jianshu.com/p/b02fcea7eb5b
https://zhuanlan.zhihu.com/p/28485468

End

走过路过,有任何问题,请不吝赐教。

你可能感兴趣的:(Python)