question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Cannot start Bokeh server, port 8787 is already in use" while instantiating a Client

See original GitHub issue

When using c = Client() from a script, I get this (on an 8 core machine):

bokeh.server.server - CRITICAL - Cannot start Bokeh server, port 8787 is already in use
bokeh.server.server - CRITICAL - Cannot start Bokeh server, port 8787 is already in use
bokeh.server.server - CRITICAL - Cannot start Bokeh server, port 8787 is already in use
bokeh.server.server - CRITICAL - Cannot start Bokeh server, port 8787 is already in use
bokeh.server.server - CRITICAL - Cannot start Bokeh server, port 8787 is already in use
bokeh.server.server - CRITICAL - Cannot start Bokeh server, port 8787 is already in use
bokeh.server.server - CRITICAL - Cannot start Bokeh server, port 8787 is already in use
bokeh.server.server - CRITICAL - Cannot start Bokeh server, port 8787 is already in use

and then it hangs.

Strange thing is, it does work OK from ipython or from a live python session. But if I create a script with the following code and try to run it (“python3 test.py”) it hangs:

from distributed import Client, local_client

client = Client()

Breaking with ctrl-c gives the following traceback:

Traceback (most recent call last):
  File "test_fib.py", line 3, in <module>
    client = Client()
Traceback (most recent call last):
  File "<string>", line 1, in <module>

Interrupted, shutting down  File "/usr/lib64/python3.5/multiprocessing/forkserver.py", line 164, in main
  File "/usr/lib/python3.5/site-packages/distributed/client.py", line 366, in __init__

    rfds = [key.fileobj for (key, events) in selector.select()]
  File "/usr/lib64/python3.5/selectors.py", line 441, in select
    self.start(timeout=timeout)
  File "/usr/lib/python3.5/site-packages/distributed/client.py", line 396, in start
    sync(self.loop, self._start, **kwargs)
  File "/usr/lib/python3.5/site-packages/distributed/utils.py", line 142, in sync
    e.wait(1000000)
    fd_event_list = self._epoll.poll(timeout, max_ev)
KeyboardInterrupt
  File "/usr/lib64/python3.5/threading.py", line 549, in wait
    signaled = self._cond.wait(timeout)
  File "/usr/lib64/python3.5/threading.py", line 297, in wait
    gotit = waiter.acquire(True, timeout)
KeyboardInterrupt
/usr/lib64/python3.5/multiprocessing/semaphore_tracker.py:129: UserWarning: semaphore_tracker: There appear to be 192 leaked semaphores to clean up at shutdown
  len(cache))

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
pitroucommented, Dec 7, 2016

Also, a simple suggestion. Instead of:

from distributed import Client, local_client

client = Client()

Have you tried:

from distributed import Client, local_client

if __name__ == "__main__":
    client = Client()
0reactions
GenevieveBuckleycommented, Oct 15, 2021

O wait, that does work when I put it in a "if name == “main”: block. so many subleties… sorry for the noise! Suppose this can be closed then.

Ok, I’m closing this issue. Progress can be tracked over at https://github.com/dask/distributed/issues/733

Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot start bokeh server - Community Support
Hi. I am trying to take code from the sliders demo and drop it in my app. When I run the sliders demo...
Read more >
FAQ — arboreto 0.1.5 documentation - Read the Docs
Q: How can I use the Dask diagnostics (bokeh) dashboard? ... By default, when no custom Client is specified, Arboreto creates a LocalCluster...
Read more >
API — Dask.distributed 2022.12.1 documentation
When a Client is instantiated it takes over all dask.compute and dask.persist calls by ... Note that the task stream diagnostic does not...
Read more >
Deploying to Heroku a Bokeh server plot embedded in Flask
And this is what I get from the heroku logs. Note there's an Cannot start Bokeh server, port 5006 is already in use"...
Read more >
arboreto Documentation - Read the Docs
Arboreto currently supports 2 GRN inference algorithms: ... distributed.scheduler - INFO - Could not launch service: ('bokeh', 8787).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found