plotly / jupyterlab-dash

An Extension for the Interactive development of Dash apps in JupyterLab
MIT License
360 stars 56 forks source link

ConnectionError: Unable to start Dash server #25

Open nite opened 5 years ago

nite commented 5 years ago

I've got a jupyterlab server, set up by colleagues & running in docker on a specific port (say 8080). I've naively set up jupyterlab dash, and running a simple dash app yields the following. If I set the port to 8080 in the app viewer, the first line is omitted but the error is the same. Any idea how I might troubleshoot and/or get some more logs for this issue?


INFO:werkzeug: * Running on http://localhost:46119/ (Press CTRL+C to quit)
---------------------------------------------------------------------------
ConnectionError                           Traceback (most recent call last)
<ipython-input-10-8ef8c89fd51e> in <module>()
     24 ])
     25 
---> 26 viewer.show(app)

~/.conda/envs/compute/lib/python3.6/site-packages/jupyterlab_dash/__init__.py in show(self, app, *args, **kwargs)
     53 
     54     def show(self, app, *args, **kwargs):
---> 55         self._perform_show(0, app, *args, **kwargs)
     56 
     57     def _perform_show(self, tries, app, *args, **kwargs):

~/.conda/envs/compute/lib/python3.6/site-packages/jupyterlab_dash/__init__.py in _perform_show(self, tries, app, *args, **kwargs)
    108             self.server_process.start()
    109 
--> 110             self._show_when_server_is_ready()
    111 
    112     def _show_when_server_is_ready(self):

~/.conda/envs/compute/lib/python3.6/site-packages/jupyterlab_dash/__init__.py in _show_when_server_is_ready(self)
    137         else:
    138             # Failed to start development server
--> 139             raise ConnectionError('Unable to start Dash server')
    140 
    141     def terminate(self):

ConnectionError: Unable to start Dash server```
nite commented 5 years ago

We've sofar figured out that this is something to do with how we hijack logging, and this hack enables it to run:

viewer.stderr_queue.write('Running on'.encode('utf-8'))
viewer.show(app)

to get this bit of viewer.show() to pass:

        while not started and retries < 100:
            try:
                out = self.stderr_queue.queue.get(timeout=.1)
                try:
                    out = out.decode()
                except AttributeError:
                    pass

                if 'Running on' in out:
                    started = True
            except Empty:
                retries += 1
                pass
nite commented 5 years ago

So, is there a better way of doing this that can't be 'hacked' by external logging config? (Admittedly, we have an issue here, but possibly there's another way of detecting a subprocess has started successfully)

martbro commented 4 years ago

Your hack worked for me but I found out that updating NodeJs solved this problem too