apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
62.53k stars 13.77k forks source link

ImportError: cannot import name 'StatsdStatsLogger' #8285

Closed syafiqdante closed 5 years ago

syafiqdante commented 5 years ago

It seems like I couldn't run superset 0.34.0 when using the command:

gunicorn \
      -w 10 \
      -k gevent \
      --timeout 120 \
      -b  0.0.0.0:8088 \
      --limit-request-line 0 \
      --limit-request-field_size 0 \
      --statsd-host localhost:8125 \
      superset:app

Expected results

Superset starts and running

Actual results

Error in python stacktrace:

[2019-09-24 09:10:35 +0800] [16049] [INFO] Starting gunicorn 19.8.1
[2019-09-24 09:10:35 +0800] [16049] [INFO] Listening at: http://0.0.0.0:8088 (16049)
[2019-09-24 09:10:35 +0800] [16049] [INFO] Using worker: gevent
[2019-09-24 09:10:35 +0800] [16084] [INFO] Booting worker with pid: 16084
[2019-09-24 09:10:35 +0800] [16086] [INFO] Booting worker with pid: 16086
[2019-09-24 09:10:35 +0800] [16085] [INFO] Booting worker with pid: 16085
[2019-09-24 09:10:35 +0800] [16103] [INFO] Booting worker with pid: 16103
[2019-09-24 09:10:35 +0800] [16104] [INFO] Booting worker with pid: 16104
[2019-09-24 09:10:36 +0800] [16121] [INFO] Booting worker with pid: 16121
[2019-09-24 09:10:36 +0800] [16123] [INFO] Booting worker with pid: 16123
[2019-09-24 09:10:36 +0800] [16124] [INFO] Booting worker with pid: 16124
[2019-09-24 09:10:36 +0800] [16141] [INFO] Booting worker with pid: 16141
[2019-09-24 09:10:36 +0800] [16143] [INFO] Booting worker with pid: 16143
[2019-09-24 09:10:39 +0800] [16124] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/ggevent.py", line 203, in init_process
    super(GeventWorker, self).init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/util.py", line 350, in import_app
    __import__(module)
  File "/root/incubator-superset-0.34.0/superset/__init__.py", line 35, in <module>
    from superset import config
  File "/root/incubator-superset-0.34.0/superset/config.py", line 25, in <module>
    from superset_config import *
  File "/root/incubator-superset-0.34.0/superset_config.py", line 39, in <module>
    from superset.stats_logger import StatsdStatsLogger
ImportError: cannot import name 'StatsdStatsLogger'
[2019-09-24 09:10:39 +0800] [16124] [INFO] Worker exiting (pid: 16124)
[2019-09-24 09:10:39 +0800] [16123] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/ggevent.py", line 203, in init_process
    super(GeventWorker, self).init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/util.py", line 350, in import_app
    __import__(module)
  File "/root/incubator-superset-0.34.0/superset/__init__.py", line 35, in <module>
    from superset import config
  File "/root/incubator-superset-0.34.0/superset/config.py", line 25, in <module>
    from superset_config import *
  File "/root/incubator-superset-0.34.0/superset_config.py", line 39, in <module>
    from superset.stats_logger import StatsdStatsLogger
ImportError: cannot import name 'StatsdStatsLogger'
[2019-09-24 09:10:39 +0800] [16123] [INFO] Worker exiting (pid: 16123)
[2019-09-24 09:10:39 +0800] [16104] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/ggevent.py", line 203, in init_process
    super(GeventWorker, self).init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/util.py", line 350, in import_app
    __import__(module)
  File "/root/incubator-superset-0.34.0/superset/__init__.py", line 35, in <module>
    from superset import config
  File "/root/incubator-superset-0.34.0/superset/config.py", line 25, in <module>
    from superset_config import *
  File "/root/incubator-superset-0.34.0/superset_config.py", line 39, in <module>
    from superset.stats_logger import StatsdStatsLogger
ImportError: cannot import name 'StatsdStatsLogger'
[2019-09-24 09:10:39 +0800] [16104] [INFO] Worker exiting (pid: 16104)
[2019-09-24 09:10:39 +0800] [16084] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/ggevent.py", line 203, in init_process
    super(GeventWorker, self).init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/util.py", line 350, in import_app
    __import__(module)
  File "/root/incubator-superset-0.34.0/superset/__init__.py", line 35, in <module>
    from superset import config
  File "/root/incubator-superset-0.34.0/superset/config.py", line 25, in <module>
    from superset_config import *
  File "/root/incubator-superset-0.34.0/superset_config.py", line 39, in <module>
    from superset.stats_logger import StatsdStatsLogger
ImportError: cannot import name 'StatsdStatsLogger'
[2019-09-24 09:10:39 +0800] [16084] [INFO] Worker exiting (pid: 16084)
[2019-09-24 09:10:39 +0800] [16085] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/ggevent.py", line 203, in init_process
    super(GeventWorker, self).init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/util.py", line 350, in import_app
    __import__(module)
  File "/root/incubator-superset-0.34.0/superset/__init__.py", line 35, in <module>
    from superset import config
  File "/root/incubator-superset-0.34.0/superset/config.py", line 25, in <module>
    from superset_config import *
  File "/root/incubator-superset-0.34.0/superset_config.py", line 39, in <module>
    from superset.stats_logger import StatsdStatsLogger
ImportError: cannot import name 'StatsdStatsLogger'
[2019-09-24 09:10:39 +0800] [16085] [INFO] Worker exiting (pid: 16085)
[2019-09-24 09:10:40 +0800] [16086] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/ggevent.py", line 203, in init_process
    super(GeventWorker, self).init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/util.py", line 350, in import_app
    __import__(module)
  File "/root/incubator-superset-0.34.0/superset/__init__.py", line 35, in <module>
    from superset import config
  File "/root/incubator-superset-0.34.0/superset/config.py", line 25, in <module>
    from superset_config import *
  File "/root/incubator-superset-0.34.0/superset_config.py", line 39, in <module>
    from superset.stats_logger import StatsdStatsLogger
ImportError: cannot import name 'StatsdStatsLogger'
[2019-09-24 09:10:40 +0800] [16086] [INFO] Worker exiting (pid: 16086)
[2019-09-24 09:10:40 +0800] [16103] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/ggevent.py", line 203, in init_process
    super(GeventWorker, self).init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/util.py", line 350, in import_app
    __import__(module)
  File "/root/incubator-superset-0.34.0/superset/__init__.py", line 35, in <module>
    from superset import config
  File "/root/incubator-superset-0.34.0/superset/config.py", line 25, in <module>
    from superset_config import *
  File "/root/incubator-superset-0.34.0/superset_config.py", line 39, in <module>
    from superset.stats_logger import StatsdStatsLogger
ImportError: cannot import name 'StatsdStatsLogger'
[2019-09-24 09:10:40 +0800] [16103] [INFO] Worker exiting (pid: 16103)
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 210, in run
    self.sleep()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 360, in sleep
    ready = select.select([self.PIPE[0]], [], [], 1.0)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 245, in handle_chld
    self.reap_workers()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 525, in reap_workers
    raise HaltServer(reason, self.WORKER_BOOT_ERROR)
gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/gunicorn", line 10, in <module>
    sys.exit(run())
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 61, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 223, in run
    super(Application, self).run()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 72, in run
    Arbiter(self).run()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 232, in run
    self.halt(reason=inst.reason, exit_status=inst.exit_status)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 345, in halt
    self.stop()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 393, in stop
    time.sleep(0.1)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 245, in handle_chld
    self.reap_workers()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 525, in reap_workers
    raise HaltServer(reason, self.WORKER_BOOT_ERROR)
gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 210, in run
    self.sleep()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 360, in sleep
    ready = select.select([self.PIPE[0]], [], [], 1.0)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 245, in handle_chld
    self.reap_workers()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 525, in reap_workers
    raise HaltServer(reason, self.WORKER_BOOT_ERROR)
gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/gunicorn", line 10, in <module>
    sys.exit(run())
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 61, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 223, in run
    super(Application, self).run()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 72, in run
    Arbiter(self).run()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 232, in run
    self.halt(reason=inst.reason, exit_status=inst.exit_status)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 345, in halt
    self.stop()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 393, in stop
    time.sleep(0.1)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 245, in handle_chld
    self.reap_workers()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 525, in reap_workers
    raise HaltServer(reason, self.WORKER_BOOT_ERROR)
gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
[2019-09-24 09:10:40 +0800] [16141] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/ggevent.py", line 203, in init_process
    super(GeventWorker, self).init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/util.py", line 350, in import_app
    __import__(module)
  File "/root/incubator-superset-0.34.0/superset/__init__.py", line 35, in <module>
    from superset import config
  File "/root/incubator-superset-0.34.0/superset/config.py", line 25, in <module>
    from superset_config import *
  File "/root/incubator-superset-0.34.0/superset_config.py", line 39, in <module>
    from superset.stats_logger import StatsdStatsLogger
ImportError: cannot import name 'StatsdStatsLogger'
[2019-09-24 09:10:40 +0800] [16141] [INFO] Worker exiting (pid: 16141)
(venv) root@server-nazmi-syafiq:~/incubator-superset-0.34.0# [2019-09-24 09:10:40 +0800] [16121] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/ggevent.py", line 203, in init_process
    super(GeventWorker, self).init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/util.py", line 350, in import_app
    __import__(module)
  File "/root/incubator-superset-0.34.0/superset/__init__.py", line 35, in <module>
    from superset import config
  File "/root/incubator-superset-0.34.0/superset/config.py", line 25, in <module>
    from superset_config import *
  File "/root/incubator-superset-0.34.0/superset_config.py", line 39, in <module>
    from superset.stats_logger import StatsdStatsLogger
ImportError: cannot import name 'StatsdStatsLogger'
[2019-09-24 09:10:40 +0800] [16121] [INFO] Worker exiting (pid: 16121)
[2019-09-24 09:10:40 +0800] [16143] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/ggevent.py", line 203, in init_process
    super(GeventWorker, self).init_process()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.6/dist-packages/gunicorn/util.py", line 350, in import_app
    __import__(module)
  File "/root/incubator-superset-0.34.0/superset/__init__.py", line 35, in <module>
    from superset import config
  File "/root/incubator-superset-0.34.0/superset/config.py", line 25, in <module>
    from superset_config import *
  File "/root/incubator-superset-0.34.0/superset_config.py", line 39, in <module>
    from superset.stats_logger import StatsdStatsLogger
ImportError: cannot import name 'StatsdStatsLogger'
[2019-09-24 09:10:40 +0800] [16143] [INFO] Worker exiting (pid: 16143)

Screenshots

If applicable, add screenshots to help explain your problem.

How to reproduce the bug

  1. Upgraded superset to superset version 0.34.0
  2. After installation, run command:
    gunicorn \
      -w 10 \
      -k gevent \
      --timeout 120 \
      -b  0.0.0.0:8088 \
      --limit-request-line 0 \
      --limit-request-field_size 0 \
      --statsd-host localhost:8125 \
      superset:app
  3. See error

Environment

(please complete the following information):

Checklist

Make sure these boxes are checked before submitting your issue - thank you!

Additional context

The same error shown when running celery using command: celery worker --app=superset.tasks.celery_app:app --pool=prefork -Ofair -c 4 --loglevel=DEBUG --max-tasks-per-child=128

Error shown:

Traceback (most recent call last):
  File "/usr/local/bin/celery", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/celery/__main__.py", line 16, in main
    _main()
  File "/usr/local/lib/python3.6/dist-packages/celery/bin/celery.py", line 322, in main
    cmd.execute_from_commandline(argv)
  File "/usr/local/lib/python3.6/dist-packages/celery/bin/celery.py", line 496, in execute_from_commandline
    super(CeleryCommand, self).execute_from_commandline(argv)))
  File "/usr/local/lib/python3.6/dist-packages/celery/bin/base.py", line 288, in execute_from_commandline
    argv = self.setup_app_from_commandline(argv)
  File "/usr/local/lib/python3.6/dist-packages/celery/bin/base.py", line 502, in setup_app_from_commandline
    self.app = self.find_app(app)
  File "/usr/local/lib/python3.6/dist-packages/celery/bin/base.py", line 524, in find_app
    return find_app(app, symbol_by_name=self.symbol_by_name)
  File "/usr/local/lib/python3.6/dist-packages/celery/app/utils.py", line 368, in find_app
    sym = symbol_by_name(app, imp=imp)
  File "/usr/local/lib/python3.6/dist-packages/celery/bin/base.py", line 527, in symbol_by_name
    return imports.symbol_by_name(name, imp=imp)
  File "/usr/local/lib/python3.6/dist-packages/kombu/utils/imports.py", line 57, in symbol_by_name
    module = imp(module_name, package=package, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/celery/utils/imports.py", line 111, in import_from_cwd
    return imp(module, package=package)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/root/incubator-superset-0.34.0/superset/__init__.py", line 35, in <module>
    from superset import config
  File "/root/incubator-superset-0.34.0/superset/config.py", line 25, in <module>
    from superset_config import *
  File "/root/incubator-superset-0.34.0/superset_config.py", line 39, in <module>
    from superset.stats_logger import StatsdStatsLogger
ImportError: cannot import name 'StatsdStatsLogger'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "/usr/local/bin/celery", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/celery/__main__.py", line 16, in main
    _main()
  File "/usr/local/lib/python3.6/dist-packages/celery/bin/celery.py", line 322, in main
    cmd.execute_from_commandline(argv)
  File "/usr/local/lib/python3.6/dist-packages/celery/bin/celery.py", line 496, in execute_from_commandline
    super(CeleryCommand, self).execute_from_commandline(argv)))
  File "/usr/local/lib/python3.6/dist-packages/celery/bin/base.py", line 288, in execute_from_commandline
    argv = self.setup_app_from_commandline(argv)
  File "/usr/local/lib/python3.6/dist-packages/celery/bin/base.py", line 502, in setup_app_from_commandline
    self.app = self.find_app(app)
  File "/usr/local/lib/python3.6/dist-packages/celery/bin/base.py", line 524, in find_app
    return find_app(app, symbol_by_name=self.symbol_by_name)
  File "/usr/local/lib/python3.6/dist-packages/celery/app/utils.py", line 368, in find_app
    sym = symbol_by_name(app, imp=imp)
  File "/usr/local/lib/python3.6/dist-packages/celery/bin/base.py", line 527, in symbol_by_name
    return imports.symbol_by_name(name, imp=imp)
  File "/usr/local/lib/python3.6/dist-packages/kombu/utils/imports.py", line 57, in symbol_by_name
    module = imp(module_name, package=package, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/celery/utils/imports.py", line 111, in import_from_cwd
    return imp(module, package=package)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/root/incubator-superset-0.34.0/superset/__init__.py", line 35, in <module>
    from superset import config
  File "/root/incubator-superset-0.34.0/superset/config.py", line 25, in <module>
    from superset_config import *
  File "/root/incubator-superset-0.34.0/superset_config.py", line 39, in <module>
    from superset.stats_logger import StatsdStatsLogger
ImportError: cannot import name 'StatsdStatsLogger'

contents of stats_logger.py

import logging

from colorama import Fore, Style

class BaseStatsLogger(object):
    """Base class for logging realtime events"""

    def __init__(self, prefix="superset"):
        self.prefix = prefix

    def key(self, key):
        if self.prefix:
            return self.prefix + key
        return key

    def incr(self, key):
        """Increment a counter"""
        raise NotImplementedError()

    def decr(self, key):
        """Decrement a counter"""
        raise NotImplementedError()

    def timing(self, key, value):
        raise NotImplementedError()

    def gauge(self, key):
        """Setup a gauge"""
        raise NotImplementedError()

class DummyStatsLogger(BaseStatsLogger):
    def incr(self, key):
        logging.debug(Fore.CYAN + "[stats_logger] (incr) " + key + Style.RESET_ALL)

    def decr(self, key):
        logging.debug((Fore.CYAN + "[stats_logger] (decr) " + key + Style.RESET_ALL))

    def timing(self, key, value):
        logging.debug(
            (Fore.CYAN + f"[stats_logger] (timing) {key} | {value} " + Style.RESET_ALL)
        )

    def gauge(self, key, value):
        logging.debug(
            (
                Fore.CYAN
                + "[stats_logger] (gauge) "
                + f"{key} | {value}"
                + Style.RESET_ALL
            )
        )

try:
    from statsd import StatsClient

    class StatsdStatsLogger(BaseStatsLogger):
        def __init__(
            self, host="localhost", port=8125, prefix="superset", statsd_client=None
        ):
            """
            Initializes from either params or a supplied, pre-constructed statsd client.

            If statsd_client argument is given, all other arguments are ignored and the
            supplied client will be used to emit metrics.
            """
            if statsd_client:
                self.client = statsd_client
            else:
                self.client = StatsClient(host=host, port=port, prefix=prefix)

        def incr(self, key):
            self.client.incr(key)

        def decr(self, key):
            self.client.decr(key)

        def timing(self, key, value):
            self.client.timing(key, value)

        def gauge(self, key):
            # pylint: disable=no-value-for-parameter
            self.client.gauge(key)

except Exception:
    pass

Sorry to disturb you guys, I'm quite new with this superset... Thanks in advance for any help...

issue-label-bot[bot] commented 5 years ago

Issue-Label Bot is automatically applying the label #bug to this issue, with a confidence of 0.67. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

dpgaspar commented 5 years ago

No problem @syafiqdante, simple question, just sanity check, do you have statsd installed on your virtualenv?

syafiqdante commented 5 years ago

No I don't think so... I have only installed statsd using pip command: pip3 install statsd pip3 install python-statsd

How do I install statsd on virtualenv..?

dpgaspar commented 5 years ago

Ok,

That's installed. Have you managed to run superset ever? if not empty your superset_config.py file and give a spin. Do you have a statsd server running on your localhost?

https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/

syafiqdante commented 5 years ago

I haven't been able to run superset using command:

gunicorn \
      -w 10 \
      -k gevent \
      --timeout 120 \
      -b  0.0.0.0:8088 \
      --limit-request-line 0 \
      --limit-request-field_size 0 \
      superset:app

and superset run -p 8088 --with-threads --reload --debugger

I have tried running superset with empty superset_config.py still nothing when I try to open the superset page at http://<my_ip:8088>/superset/ from the stacktrace, it seems to be working using the superset run -p 8088 --with-threads --reload --debugger command:

2019-09-26 09:46:26,277:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
 * Serving Flask app "superset:app" (lazy loading)
 * Environment: development
 * Debug mode: on
2019-09-26 09:46:27,616:INFO:werkzeug: * Running on http://127.0.0.1:8088/ (Press CTRL+C to quit)
2019-09-26 09:46:27,617:INFO:werkzeug: * Restarting with stat
2019-09-26 09:46:29,494:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
2019-09-26 09:46:30,843:WARNING:werkzeug: * Debugger is active!
2019-09-26 09:46:30,850:INFO:werkzeug: * Debugger PIN: 410-272-582

Kinda stuck here for a while now... Please help, Thanks in advance.

dpgaspar commented 5 years ago

The log looks good what do you mean by http://<my_ip:8088>/superset, have you tried http://127.0.0.1:8088 ?

syafiqdante commented 5 years ago

It's installed in remote pc (OS version: Ubuntu 16.04.5 LTS) act as server at at address

Its mind boggling when the log shows superset is running but nothing is on the http://<my_ip>:8088/superset

dpgaspar commented 5 years ago

Using 127.0.0.1 will never work, use 0.0.0.0. Going to close this issue, feel free to reopen if you need to. Enjoy Superset!

syafiqdante commented 5 years ago

Using 127.0.0.1 will never work, use 0.0.0.0. Going to close this issue, feel free to reopen if you need to. Enjoy Superset!

Using this doesn't work either... page empty

previously, using superset 0.28.1, I was able to open superset at http://<my_ip:8088/superset>

dpgaspar commented 5 years ago

I meant changing to 0.0.0.0 on the server not on the browser, localhost is bound to the loopback net device

syafiqdante commented 5 years ago

Sorry to ask, how do I change it to 0.0.0.0..? do I change it at superset_config.py?

jlfsdtc commented 4 years ago

maybe youcan try: when gunicorn start add '--statsd-host localhost:xxxx'

MaiTaiSon commented 11 months ago

No I don't think so... I have only installed statsd using pip command: pip3 install statsd pip3 install python-statsd

How do I install statsd on virtualenv..?

Just install statsd, it worked for me