Search code examples
pythonparallel-processingjupyter-notebookjupyterjoblib

Printed output not displayed when using joblib in jupyter notebook


So I am using joblib to parallelize some code and I noticed that I couldn't print things when using it inside a jupyter notebook.

I tried using doing the same example in ipython and it worked perfectly.

Here is a minimal (not) working example to write in a jupyter notebook cell

from joblib import Parallel, delayed
Parallel(n_jobs=8)(delayed(print)(i) for i in range(10))

So I am getting the output as [None, None, None, None, None, None, None, None, None, None] but nothing is printed.

What I expect to see (print order could be random in reality):

1
2
3
4
5
6
7
8
9
10
[None, None, None, None, None, None, None, None, None, None]

Note:

You can see the prints in the logs of the notebook process. But I would like the prints to happen in the notebook, not the logs of the notebook process.

EDIT

I have opened a Github issue, but with minimal attention so far.


Solution

  • This problem is fixed in the latest version of ipykernel. To solve the issue just do pip install --upgrade ipykernel.

    From what I understand, any version above 6 will do, as mentioned in this Github comment by one of the maintainers.