superset0.28.1安装、初始化、运行以及相关错误解决

【安装方法】

# 1. 创建虚拟环境并指定python版本:  
conda create -n superset_env python=3.6

# 2. 直接安装superset
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple superset

# 期间可能安装失败,比如prison提示失败,那么单独装上prison
pip install prison

# 如果提示环境不满足安装要求,那么按照官网装上相应的包
# 注意,我们这里使用anaconda,就不需要再装python-devel python-pip python-wheel了
sudo yum install gcc gcc-c++ libffi-devel  openssl-devel libsasl2-devel openldap-devel

【安装之后的操作】

# 1.初始化数据库
superset db upgrade

# 2. 创建admin用户,注意要设置环境变量 FLASK_APP 这样才能找得到命名
$ export FLASK_APP=superset
flask fab create-admin


# 3. 自己决定是否要load一些样本数据到superset,方便体验
superset load_examples

# 4. 初始化角色role和权限permissions
superset init


# 5. 启动superset
superset run -p 8080 --with-threads --reload --debugger

 

=================================================================

【错误1】mysql驱动没安装

ModuleNotFoundError: No module named 'MySQLdb'

解决方法: pip install mysqlclient

【错误2】pandas版本问题

(superset_env) [appuser@hadoop03 ~]$ superset db upgrade
Traceback (most recent call last):
  File "/home/appuser/.conda/envs/superset_env/bin/superset", line 6, in 
    from superset.cli import create_app
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/superset/__init__.py", line 196, in 
    ConnectorRegistry.register_sources(module_datasource_map)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/superset/connectors/connector_registry.py", line 14, in register_sources
    module_obj = __import__(module_name, fromlist=class_names)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/superset/connectors/sqla/__init__.py", line 2, in 
    from . import views  # noqa
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/superset/connectors/sqla/views.py", line 13, in 
    from superset.connectors.base.views import DatasourceModelView
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/superset/connectors/base/views.py", line 5, in 
    from superset.views.base import SupersetModelView
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/superset/views/__init__.py", line 2, in 
    from . import core  # noqa
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/superset/views/core.py", line 30, in 
    from superset import (
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/superset/sql_lab.py", line 14, in 
    from superset import app, dataframe, db, results_backend, security_manager
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/superset/dataframe.py", line 14, in 
    from pandas.core.common import _maybe_box_datetimelike
ImportError: cannot import name '_maybe_box_datetimelike'

查看下安装的pandas版本: pip list | grep pandas  发现pandas是0.24.2   而 pip list | grep superset 发现superset版本是0.28.1查看源码的requirements.txt发现要求的pandas版本是pandas==0.23.1 

【错误3】sqlalchemy版本错误

Traceback (most recent call last):
  File "/home/appuser/.conda/envs/superset_env/bin/superset", line 15, in 
    cli()
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/flask/cli.py", line 380, in main
    return AppGroup.main(self, *args, **kwargs)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/flask/cli.py", line 257, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/flask_migrate/cli.py", line 134, in upgrade
    _upgrade(directory, revision, sql, tag, x_arg)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/flask_migrate/__init__.py", line 95, in wrapped
    f(*args, **kwargs)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/flask_migrate/__init__.py", line 280, in upgrade
    command.upgrade(config, revision, sql=sql, tag=tag)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/alembic/command.py", line 276, in upgrade
    script.run_env()
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/alembic/script/base.py", line 475, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/alembic/util/pyfiles.py", line 90, in load_python_file
    module = load_module_py(module_id, path)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/alembic/util/compat.py", line 177, in load_module_py
    spec.loader.exec_module(module)
  File "", line 678, in exec_module
  File "", line 219, in _call_with_frames_removed
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/superset/migrations/env.py", line 100, in 
    run_migrations_online()
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/superset/migrations/env.py", line 93, in run_migrations_online
    context.run_migrations()
  File "", line 8, in run_migrations
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/alembic/runtime/environment.py", line 839, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/alembic/runtime/migration.py", line 362, in run_migrations
    step.migration_fn(**kw)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/superset/migrations/versions/4451805bbaa1_remove_double_percents.py", line 82, in upgrade
    replace('%%', '%')
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/superset/migrations/versions/4451805bbaa1_remove_double_percents.py", line 53, in replace
    .join(Table)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2239, in join
    from_joinpoint=from_joinpoint,
  File "", line 2, in _join
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/sqlalchemy/orm/base.py", line 220, in generate
    fn(self, *args[1:], **kw)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2418, in _join
    left, right, onclause, prop, create_aliases, outerjoin, full
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2441, in _join_left_to_right
    ) = self._join_determine_implicit_left_side(left, right, onclause)
  File "/home/appuser/.conda/envs/superset_env/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2572, in _join_determine_implicit_left_side
    "Can't determine which FROM clause to join "
sqlalchemy.exc.InvalidRequestError: Can't determine which FROM clause to join from, there are multiple FROMS which can join to this entity. Try adding an explicit ON clause to help resolve the ambiguity.

(superset_env) [appuser@hadoop03 ~]$ pip list |grep -i sqlalchemy
Flask-SQLAlchemy       2.4.0      
marshmallow-sqlalchemy 0.17.0     
SQLAlchemy             1.3.5      
SQLAlchemy-Utils       0.34.1     
 

而superset要求的版本是 sqlalchemy==1.2.2

通过 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple sqlalchemy==1.2.2 进行安装

 

 

 

========================================================

如下为superset0.28.1版本的requirements.txt

#
# This file is autogenerated by pip-compile
# To update, run:
#
#    pip-compile --output-file requirements.txt setup.py
#
alembic==1.0.0            # via flask-migrate
amqp==2.3.2               # via kombu
asn1crypto==0.24.0        # via cryptography
babel==2.6.0              # via flask-babel, flower
billiard==3.5.0.4         # via celery
bleach==2.1.2
boto3==1.4.7
botocore==1.7.48
cchardet==1.1.3           # via tabulator
celery==4.2.0
certifi==2018.8.24        # via requests
cffi==1.11.5              # via cryptography
chardet==3.0.4            # via requests
click==6.7                # via flask, flask-appbuilder, tableschema, tabulator
colorama==0.3.9
contextlib2==0.5.5
cryptography==1.9
defusedxml==0.5.0         # via python3-openid
docutils==0.14            # via botocore
et-xmlfile==1.0.1         # via openpyxl
flask-appbuilder==1.12.0
flask-babel==0.11.1       # via flask-appbuilder
flask-caching==1.4.0
flask-compress==1.4.0
flask-login==0.4.1        # via flask-appbuilder
flask-migrate==2.1.1
flask-openid==1.2.5       # via flask-appbuilder
flask-sqlalchemy==2.1     # via flask-appbuilder, flask-migrate
flask-wtf==0.14.2
flask==0.12.2
flower==0.9.2
future==0.16.0
futures==3.1.1            # via flower
geopy==1.11.0
gunicorn==19.8.0
html5lib==1.0.1           # via bleach
humanize==0.5.1
idna==2.6
ijson==2.3                # via tabulator
isodate==0.6.0
itsdangerous==0.24        # via flask
jdcal==1.4                # via openpyxl
jinja2==2.10              # via flask, flask-babel
jmespath==0.9.3           # via boto3, botocore
jsonlines==1.2.0          # via tabulator
jsonschema==2.6.0         # via tableschema
kombu==4.2.1              # via celery
linear-tsv==1.1.0         # via tabulator
mako==1.0.7               # via alembic
markdown==3.0
markupsafe==1.0           # via jinja2, mako
numpy==1.15.2             # via pandas
openpyxl==2.4.11          # via tabulator
pandas==0.23.1
parsedatetime==2.0.0
pathlib2==2.3.0
polyline==1.3.2
pycparser==2.19           # via cffi
pydruid==0.4.4
pyhive==0.5.1
python-dateutil==2.6.1
python-editor==1.0.3      # via alembic
python-geohash==0.8.5
python3-openid==3.1.0     # via flask-openid
pytz==2018.5              # via babel, celery, flower, pandas
pyyaml==3.12
requests==2.18.4
rfc3986==1.1.0            # via tableschema
s3transfer==0.1.13        # via boto3
sasl==0.2.1               # via thrift-sasl
simplejson==3.15.0
sqlalchemy-utils==0.32.21
sqlalchemy==1.2.2
sqlparse==0.2.4
tableschema==1.1.0
tabulator==1.15.0         # via tableschema
thrift-sasl==0.3.0
thrift==0.11.0
tornado==5.1.1            # via flower
unicodecsv==0.14.1
unidecode==1.0.22
urllib3==1.22             # via requests
vine==1.1.4               # via amqp
webencodings==0.5.1       # via html5lib
werkzeug==0.14.1          # via flask
wtforms==2.2.1            # via flask-wtf
xlrd==1.1.0               # via tabulator

 

你可能感兴趣的:(superset,python,superset,BI报表,自助分析提数,OLAP工具)