ProgressMeter in VSCode Jupyter Notebooks

I am trying to use ProgressMeter and @showprogress in VS Code inside of a Jupyter notebook. When I do, I get many progress bars printed out in succession:


This is not what happens when I use Jupyter notebooks in the browser. There, I get one bar that fills as the task completes, so I don’t have a wall of progress that makes it annoying to scroll through. Does anybody know if there is a setting in VS Code that can fix this?

1 Like

I don’t think there is, the notebook support in vs code is still under development both upstream and from the Julia side. If you want to for an issue check with both the Julia vs code extension repo and the upstream MS repo.

Does you code use some hidden println or equivalent, or returns something ? I had the same issue at some point, I have to check again how I solved this

Yes. This is progress from a function which returns trained neural network parameters.

Try calling ProgressMeter.ijulia_behavior(:clear) and see if it fixes the problem.

To elaborate, ProgressMeter.jl has special handling of Jupyter notebooks because their output fields are not terminals, see https://github.com/timholy/ProgressMeter.jl#progressmeter-with-additional-information-in-jupyter. Perhaps it’s not detecting VS Code in the same way. I’m not familiar with the internals of the package and I don’t use VS Code, so I don’t know whether the snippet above will fix the problem, but it’s worth a try.

There’s also an issue here: It shows repeated output in VScode · Issue #231 · timholy/ProgressMeter.jl · GitHub

It didn’t fix the problem, but thanks anyway!