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.

dask.distributed client hangs in VSCode

See original GitHub issue

Assistance request for those using vscode (https://github.com/microsoft/vscode-python/issues/7845):

dask - 2.6.0 vscode - 1.39.2 (latest but version independent) python extension - 2019.10.41019 (it’s tied to this version but vscode team cannot find issue without diving into dask)

Steps for bug

from dask.distributed import Client
client = Client()
  • start Python Interactive and paste this in input terminal and we get never ending stream of
distributed.nanny - WARNING - Restarting worker
distributed.nanny - WARNING - Restarting worker
...
  • restart notebook server (using interactive window) and run same code and it runs fine.

If you run this code in python, ipython or jupyter notebook, no problems.

If anyone using vscode this is very easy to reproduce and if you can find a possible cause for the error I can open a new issue and hopefully point the team towards the right direction.

Thank you

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:25 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
mgsnunocommented, Jul 22, 2020

@harrisliuwk I have experienced the same, it is tied to multiprocessing.

I agree with @mrocklin to reproduce this using just the multiprocessing and asyncio modules and find the (timing) issues mentioned in https://github.com/microsoft/vscode-python/issues/7845#issuecomment-543990049.

I have been using dask-kubernetes in azure aks and stopped trying to find the issue.

EDIT: just ran a quick test in VSCode

from dask.distributed import Client
client = Client()

generates an endless stream of errors:

tornado.application - ERROR - Exception in callback <bound method Nanny.memory_monitor of <Nanny: None, threads: 2>>
Traceback (most recent call last):
  File "/home/user/miniconda3/envs/test/lib/python3.8/site-packages/tornado/ioloop.py", line 907, in _run
    return self.callback()
  File "/home/user/miniconda3/envs/test/lib/python3.8/site-packages/distributed/nanny.py", line 414, in memory_monitor
    process = self.process.process
AttributeError: 'NoneType' object has no attribute 'process'

versions: dask: 2.20.0 distributed: 2.20.0 ms-python extension: 2020.7.94776 python: 3.8.3 os: linux

2reactions
harrisliuwkcommented, Jul 22, 2020

Just an update on identifying the problem.

platform: Windows 10 Version 1809 Dask: 2.20.0 VSCode: 1.47.2

It seems that the problem is compatibility between Dask and VSCode’s Python Interactive Window.

When you do

from distributed import Client
client = Client()

and

from distributed import LocalCluster 
client = LocalCluster()

both work well with powershell and VSCode’s Jupyter notebook environment. Note that the default for both Client and LocalCluster is processes=True.

But if you run the example codes above in Python Interactive Window, it just hangs forever, and there’s no error message printed out. Instead if you do

from distributed import Client
client = Client(processes=False)

and

from distributed import LocalCluster 
client = LocalCluster(processes=False)

in Interactive Window, the code will run as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dask.distributed client hangs in VSCode · Issue #5574 - GitHub
One approach to resolve this problem would be to try to reproduce the error without Dask, and then raise that back on the...
Read more >
Dask Distributed with MS VS2017 - Stack Overflow
However, the code crashes and no dashboard loads under Visual Studio. Both IDEs are running under the same environment I am using the...
Read more >
Debug - Dask documentation
Logging for specific components like distributed.client , distributed.scheduler , distributed.nanny , distributed.worker , etc.
Read more >
Distributed Python at home: DASK with VSCode on top.
Data scientists, and others, can write and test parallel/ distributed python code on their local machines without complicated using DASK and ...
Read more >
Distributed Computing with dask - Practical Data Science
from dask.distributed import Client client = Client() client ... is that to prevent crashes, you have to understand how and why dask is...
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