VSCode: Unable to debug learn.fit

Hi there,

I’m having trouble debugging over functions like learn.fit_one_cycle in VSCode. The IDE hangs, showing a progress bar that doesn’t update (and seemingly never ends):

Note that the debugger is executed with the following command:

`cd ~/fast.ai ; env PYTHONIOENCODING=UTF-8 PYTHONUNBUFFERED=1 ~/.miniconda3/envs/fast.ai/bin/python ~/.vscode/extensions/ms-python.python-2019.2.5558/pythonFiles/ptvsd_launcher.py --default --client --host localhost --port 54812 ~/fast.ai/test.py

Does anything look suspicious?

If I don’t debug the code and instead simply execute the code with ~/.miniconda3/envs/fast.ai/bin/python ~/fast.ai/test.py then everything works fine:

I wanted to know if anyone has experienced this and has any solutions. If not, I’ll file a bug with the VSCode team and see if they can help.

Note that debugging the same code on PyCharm works, though no progress bar is shown – only the results (fine):

Smells like a bug in whatever debugger Microsoft has built for the Python Extension.


1 Like

For anyone experiencing a similar issue, I’ve filed a bug for Microsoft here

The solution is here. Simply add this to the top of the file you’d like to debug:

import multiprocessing
multiprocessing.set_start_method("spawn", True)



Thanks very much, I have been having this exact problem