Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deprecation warning from Jupyter: "`should_run_async` will not call `transform_cell` automatically in the future"

Tags:

python

jupyter

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

like image 305
Gianluigi Avatar asked Aug 14 '20 13:08

Gianluigi


People also ask

What does deprecation warning mean in Python?

removing is danger because user may used that and if a developer want to remove a thing first have to notify others to don't use this feature or things and after this he can remove. and DeprecationWarning is this notification.

What does deprecation warning mean?

Deprecation warnings are a common thing in our industry. They are warnings that notify us that a specific feature (e.g. a method) will be removed soon (usually in the next minor or major version) and should be replaced with something else.

How do you add a deprecation warning in Python?

To warn about deprecation, you need to set Python's builtin DeprecationWarning as category. To let the warning refer to the caller, so you know exactly where you use deprecated code, you have to set stacklevel=2 .

Why does pytest-nbval fail in Jupyter Notebook?

This fixes an issue happens in jupyter notebook. MAVENSDC/PyTplot#122 Fix ipython version to avoid warnings. There were some weird warnings coming from an internal `ipython`/`ipykernel` API, causing `pytest-nbval` to fail its tests. So, downgrading `ipython` to 7.10 until that is fixed.

Why does my Jupyter Notebook crash when get_y_range is called?

We’ll occasionally send you account related emails. Already on GitHub? Sign in to your account This fixes an issue happens in jupyter notebook. The jupyter notebook crashes when the get_y_range is called in tplot_utilitis.py The root cause of this issue seems to be a bug in ipykernel.

What version of Jupyter is installed on Mac OS X?

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 Show activity on this post. Upgrading ipykernel 5.3.4 seems to have fixed it for me. Make sure to restart your Juptyer server afterwards.


3 Answers

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.

like image 146
Andy Jones Avatar answered Oct 16 '22 20:10

Andy Jones


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)
like image 28
Tomasz Zielański Avatar answered Oct 16 '22 21:10

Tomasz Zielański


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.

like image 1
Guillaume Ansanay-Alex Avatar answered Oct 16 '22 20:10

Guillaume Ansanay-Alex