10步搞定windows安装superset

1:anaconda创建新的python环境

conda create -n python37 python=3.7

2:环境激活

activate python37

3:根据官网文档安装cryptography以及新建Temp文件夹

pip install cryptography
md C:\Temp(貌似没啥用)

4: 跟新setuptools 和pip

pip install --upgrade setuptools pip

5:安装 superset

pip install superset 
报错1:超时
Traceback (most recent call last):
  File "C:\Andaconda2\envs\python37\lib\site-packages\pip\_internal\cli\base_command.py", line 179, in main
    status = self.run(options, args)
  File "C:\Andaconda2\envs\python37\lib\site-packages\pip\_internal\commands\install.py", line 315, in run
    resolver.resolve(requirement_set)
  File "C:\Andaconda2\envs\python37\lib\site-packages\pip\_internal\resolve.py", line 131, in resolve
    self._resolve_one(requirement_set, req)
  File "C:\Andaconda2\envs\python37\lib\site-packages\pip\_internal\resolve.py", line 294, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "C:\Andaconda2\envs\python37\lib\site-packages\pip\_internal\resolve.py", line 242, in _get_abstract_dist_for
    self.require_hashes
  File "C:\Andaconda2\envs\python37\lib\site-packages\pip\_internal\operations\prepare.py", line 334, in prepare_linked_requirement
    progress_bar=self.progress_bar
  File "C:\Andaconda2\envs\python37\lib\site-packages\pip\_internal\download.py", line 878, in unpack_url
    progress_bar=progress_bar
  File "C:\Andaconda2\envs\python37\lib\site-packages\pip\_internal\download.py", line 702, in unpack_http_url
    progress_bar)
  File "C:\Andaconda2\envs\python37\lib\site-packages\pip\_internal\download.py", line 946, in _download_http_url
    _download_url(resp, link, content_file, hashes, progress_bar)
  File "C:\Andaconda2\envs\python37\lib\site-packages\pip\_internal\download.py", line 639, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "C:\Andaconda2\envs\python37\lib\site-packages\pip\_internal\utils\hashes.py", line 62, in check_against_chunks
    for chunk in chunks:
  File "C:\Andaconda2\envs\python37\lib\site-packages\pip\_internal\download.py", line 607, in written_chunks
    for chunk in chunks:
  File "C:\Andaconda2\envs\python37\lib\site-packages\pip\_internal\utils\ui.py", line 159, in iter
    for x in it:
  File "C:\Andaconda2\envs\python37\lib\site-packages\pip\_internal\download.py", line 596, in resp_read
    decode_content=False):
  File "C:\Andaconda2\envs\python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 494, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "C:\Andaconda2\envs\python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 459, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "C:\Andaconda2\envs\python37\lib\contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Andaconda2\envs\python37\lib\site-packages\pip\_vendor\urllib3\response.py", line 365, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

更换国内数据源

pip install superset -i https://mirrors.aliyun.com/pypi/simple/
报错2:Microsoft Visual C++14报错

vs14解决

搜索下载 Microsoft Visual C++ Build Tools http://go.microsoft.com/fwlink/?LinkId=691126

  • 完成安装后再次执行
pip install superset -i https://mirrors.aliyun.com/pypi/simple/
  • 未报错则成功安装superset

6:创建管理员

fabmanager create-admin --app superset
报错
Repeat for confirmation:
Was unable to import superset Error: cannot import name '_maybe_box_datetimelike' from 'pandas.core.common' (c:\andaconda2\envs\python37\lib\site-packages\pandas\core\common.py)

错误解决

pip uninstall pandas
pip instlal pandas==0.23.4

创建成功

7:设置数据库

(python37) C:\Users\Victor>fabmanager create-admin --app superset
Username [admin]: ***
User first name [admin]: ***
User last name [user]: ****
Email [admin@fab.org]: ****
Password:
Repeat for confirmation:
Recognized Database Authentications.
Admin User renshen created.
(python37) C:\Users\Victor>cd C:\Andaconda2\envs\python37\Lib\site-packages\superset\bin

(python37) C:\Andaconda2\envs\python37\Lib\site-packages\superset\bin>Python  superset db upgrade
报错
File "<string>", line 8, in run_migrations
  File "C:\Andaconda2\envs\python37\lib\site-packages\alembic\runtime\environment.py", line 839, in run_migrations
    self.get_context().run_migrations(**kw)
  File "C:\Andaconda2\envs\python37\lib\site-packages\alembic\runtime\migration.py", line 361, in run_migrations
    step.migration_fn(**kw)
  File "C:\Andaconda2\envs\python37\lib\site-packages\superset\migrations\versions\4451805bbaa1_remove_double_percents.py", line 82, in upgrade
    replace('%%', '%')
  File "C:\Andaconda2\envs\python37\lib\site-packages\superset\migrations\versions\4451805bbaa1_remove_double_percents.py", line 53, in replace
    .join(Table)
  File "C:\Andaconda2\envs\python37\lib\site-packages\sqlalchemy\orm\query.py", line 2235, in join
    from_joinpoint=from_joinpoint,
  File "<string>", line 2, in _join
  File "C:\Andaconda2\envs\python37\lib\site-packages\sqlalchemy\orm\base.py", line 220, in generate
    fn(self, *args[1:], **kw)
  File "C:\Andaconda2\envs\python37\lib\site-packages\sqlalchemy\orm\query.py", line 2414, in _join
    left, right, onclause, prop, create_aliases, outerjoin, full
  File "C:\Andaconda2\envs\python37\lib\site-packages\sqlalchemy\orm\query.py", line 2437, in _join_left_to_right
    ) = self._join_determine_implicit_left_side(left, right, onclause)
  File "C:\Andaconda2\envs\python37\lib\site-packages\sqlalchemy\orm\query.py", line 2568, 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.
解决
pip install sqlalchemy==1.2.18

参考https://github.com/apache/incubator-superset/issues/6977

(python37) C:\Andaconda2\envs\python37\Lib\site-packages\superset\bin>Python  superset db upgrade
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade bddc498dd179 -> 4451805bbaa1, remove double percents
INFO  [alembic.runtime.migration] Running upgrade 4451805bbaa1, 1d9e835a84f9 -> 705732c70154, empty message
INFO  [alembic.runtime.migration] Running upgrade 4451805bbaa1, 1d9e835a84f9 -> fc480c87706c, empty message
INFO  [alembic.runtime.migration] Running upgrade fc480c87706c -> bebcf3fed1fe, Migrate dashboard position_json data from V1 to V2
INFO  [alembic.runtime.migration] Running upgrade bebcf3fed1fe, 705732c70154 -> ec1f88a35cc6, empty message
INFO  [alembic.runtime.migration] Running upgrade 4451805bbaa1, 1d9e835a84f9 -> e3970889f38e, empty message
INFO  [alembic.runtime.migration] Running upgrade 705732c70154, e3970889f38e -> 46ba6aaaac97, empty message
INFO  [alembic.runtime.migration] Running upgrade 46ba6aaaac97, ec1f88a35cc6 -> c18bd4186f15, empty message
INFO  [alembic.runtime.migration] Running upgrade c18bd4186f15 -> 7fcdcde0761c, Reduce position_json size by remove extra space and component id prefix
INFO  [alembic.runtime.migration] Running upgrade 7fcdcde0761c -> 0c5070e96b57, add user attributes table
INFO  [alembic.runtime.migration] Running upgrade 0c5070e96b57 -> 1a1d627ebd8e, position_json
INFO  [alembic.runtime.migration] Running upgrade 1a1d627ebd8e -> 55e910a74826, add_metadata_column_to_annotation_model.py

8:导入数据

(python37) C:\Andaconda2\envs\python37\Lib\site-packages\superset\bin>python superset load_examples
Creating table [birth_names] reference
2019-04-17 19:56:14,768:INFO:root:Creating database reference
Creating some slices
Creating a dashboard
Loading [Misc Charts] dashboard
Creating the dashboard
Loading DECK.gl demo
Loading deck.gl dashboard
Creating Scatterplot slice
Creating Screen Grid slice
Creating Hex slice
Creating Grid slice
Creating Polygon slice
Creating Arc slice
Creating Path slice
Creating a dashboard

9: 创建用户及配置默认权限

(python37) C:\Andaconda2\envs\python37\Lib\site-packages\superset\bin>python superset init
2019-04-17 19:56:41,307:INFO:root:Creating database reference
2019-04-17 19:56:41,317:INFO:root:Syncing role definition
2019-04-17 19:56:41,413:INFO:root:Syncing Admin perms
2019-04-17 19:56:41,542:INFO:root:Syncing Alpha perms
2019-04-17 19:56:42,118:INFO:root:Syncing Gamma perms
2019-04-17 19:56:42,651:INFO:root:Syncing granter perms
2019-04-17 19:56:43,109:INFO:root:Syncing sql_lab perms
2019-04-17 19:56:43,652:INFO:root:Fetching a set of all perms to lookup which ones are missing
2019-04-17 19:56:44,953:INFO:root:Creating missing datasource permissions.
2019-04-17 19:56:44,969:INFO:root:Creating missing database permissions.
2019-04-17 19:56:45,017:INFO:root:Creating missing metrics permissions
2019-04-17 19:56:45,041:INFO:root:Cleaning faulty perms

10:启动服务

(python37) C:\Andaconda2\envs\python37\Lib\site-packages\superset\bin>python superset runserver -d

至此,车子已成功发动,剩下的大家就慢慢愉快的玩耍去吧


版权声明:本文为sinat_29297223原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。