35

When I import a package I get the following deprecation message. I can't find any documentation about it. I know I can suppress the warnings but I would like to know what's happening.

import pandas as pd

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ipykernel/ipkernel.py:287: DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in the future. Please pass the result to `transformed_cell` argument and any exception that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 and above.
  and should_run_async(code)

Installation: Python 3.8.5, jupyter-client 6.1.6, jupyter-core 4.6.3, jupyterlab 2.2.4, jupyterlab-server 1.2.0 on Mac OS

Georgy
  • 12,464
  • 7
  • 65
  • 73
Gianluigi
  • 451
  • 1
  • 4
  • 5
  • 2
    That's an internal warning. Only things you can do is 1) upgrade everything to its latest version or 2) supress/ignore it – Paul H Aug 14 '20 at 14:06
  • 1
    I have upgraded everything already trying to get rid of it but it's still there :( – Gianluigi Aug 14 '20 at 14:08
  • 1
    You don't need to worry about it. Not all (releases of) libraries are programmed against the absolutely latest (released versions of) their dependencies. That's why we have deprecation warnings and cycles: to let library devs and users that things will change in the future. You can gnore or suppress the warning. But you don't need to worry about it. – Paul H Aug 14 '20 at 17:04
  • Thanks. I'll filter it out. – Gianluigi Aug 14 '20 at 17:28

3 Answers3

22

Upgrading ipykernel 5.3.4 seems to have fixed it for me.

pip install --upgrade ipykernel

Make sure to restart your Juptyer server afterwards.

I came up with this by inserting a breakpoint() at /ipkernel.py:287 and using w to see what was making the call. If this fix doesn't work for you, worth checking what's making the call in your case.

Andy Jones
  • 4,723
  • 2
  • 19
  • 24
  • 1
    Thanks. In my case the problem was with ipython. I deleted the .ipython directory and then reinstalled ipython and the warning doesn't show any more. Ii is not enough to reinstall ipython, one has to delete that directory first. – Gianluigi Aug 19 '20 at 21:07
  • 2
    Didn't work for me for some weird reason :( I ended up downgrading to 7.10. – Mtrinidad Oct 06 '20 at 04:57
20

Same here with ipykernel==5.3.4 and ipython==7.19.0. Downgrading to ipython 7.10.0 fixed the problem.

pip install ipython==7.10.0

Optionally for suppressing DeprecationWarnings:

import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
Sumax
  • 631
  • 1
  • 7
  • 13
  • 2
    version 7.10.0 is not available with conda but the 7.10.1 it is and also fixes the problem for me. – Iván Dec 15 '20 at 18:39
  • 2
    For people using Python 3.9, note that ipython 7.10.* is only available with Python < 3.9 so this downgrade won't work. – gboeing Dec 23 '20 at 22:24
2

Same here with python==3.9.2, ipykernel==5.5.0 and ipython==7.21.0 in a conda environment defaulting to conda-forge repositories. Upgrading ipykernel to the latest 5.5.3 doesn't solve anything.

It is currently linked to this ipykernel issue.

Guillaume Ansanay-Alex
  • 1,212
  • 2
  • 9
  • 20