项目场景:
superset安装好后到了加载官方示例数据这一步,需要运行指令load_examples,但不知道是不是墙的原因,总是报一个无法连接的错。
问题描述:
load_examples指令:
(venv) D:\WYJ\PyCharm Projects\superset-0.34\superset\bin>python superset load_examples
报错内容如下:
2021-05-06 14:11:30,320:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
Loading examples metadata and related data into examples
Creating default CSS templates
Loading energy related dataset
2021-05-06 14:11:31,234:INFO:root:Database.get_sqla_engine(). Masked URL: sqlite:///C:\Users\86185\.superset\superset.db
Traceback (most recent call last):
File "superset", line 31, in <module>
cli()
File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\click\core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\flask\cli.py", line 586, in main
return super(FlaskGroup, self).main(*args, **kwargs)
File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\click\decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\flask\cli.py", line 426, in decorator
return __ctx.invoke(f, *args, **kwargs)
File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "d:\wyj\pycharm projects\superset-0.34\superset\cli.py", line 143, in load_examples
load_examples_run(load_test_data, only_metadata, force)
File "d:\wyj\pycharm projects\superset-0.34\superset\cli.py", line 84, in load_examples_run
examples.load_energy(only_metadata, force)
File "d:\wyj\pycharm projects\superset-0.34\superset\examples\energy.py", line 38, in load_energy
data = get_example_data("energy.json.gz")
File "d:\wyj\pycharm projects\superset-0.34\superset\examples\helpers.py", line 73, in get_example_data
content = request.urlopen(f"{BASE_URL}{filepath}?raw=true").read()
File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 525, in open
response = self._open(req, data)
File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 543, in _open
'_open', req)
File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 503, in _call_chain
result = func(*args)
File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 1360, in https_open
context=self._context, check_hostname=self._check_hostname)
File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 1320, in do_open
r = h.getresponse()
File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1336, in getresponse
response.begin()
File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 306, in begin
version, status, reason = self._read_status()
File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 267, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\ssl.py", line 1071, in recv_into
return self.read(nbytes, buffer)
File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\ssl.py", line 929, in read
return self._sslobj.read(len, buffer)
TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
原因分析:
可能是国外服务器访问不太稳定,不过只是无法加载示例数据,不能展示酷炫的官方demo了,不影响suprset的其他使用。
解决方案:
把示例数据从GitHub上下载下来,放到本地服务器上,然后修改helpers.py文件中的BASE_URL。具体步骤如下:
1.下载GitHub示例数据;
2.我用的是apache tomcat,它的根目录在~\webapps\ROOT。下载下来的压缩包解压后放到这个目录下。
3.在superset源码中找到helpers.py文件,把其中的BASE_URL改为自己的服务器地址。
然后就可以进行以后的步骤了。