Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeprecationWarning has unclear origin: should_run_async will not call transform_cell automatically in the future #540

Closed
courtarro opened this issue Aug 20, 2020 · 21 comments · Fixed by #605 or #617
Milestone

Comments

@courtarro
Copy link

This deprecation appears when I have warnings enabled, as of some time within the past week or so, and it is unclear what its origin is. How would I go about finding what component is causing this warning to appear?

For the record, the following code causes the problem to appear:

import warnings
import pandas as pd
warnings.simplefilter('always')
pd.read_csv('filename.csv')

I could turn off warnings, obviously, but I need them for other situations. Hiding the issue doesn't really fix it, of course. I have the standard contrib notebook extensions installed also.

@Carreau Carreau transferred this issue from ipython/ipython Aug 20, 2020
@Carreau
Copy link
Member

Carreau commented Aug 20, 2020

Sorry those are just internal APIs.I transfered this issue to IPykernel repository.

@lingyunfeng
Copy link

me too

@lingyunfeng
Copy link

print ('hello')
hello
/usr/local/miconda3/envs/py37/lib/python3.7/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)

@lingyunfeng
Copy link

I Find a idea to this problem.

change ipkernel.py:287 line code :
#and should_run_async(code)
and should_run_async(code,transformed_cell=code)
@courtarro @Carreau

@Carreau
Copy link
Member

Carreau commented Aug 21, 2020

and should_run_async(code,transformed_cell=code)

no, that is wrong, that will break many of the magics and specific IPython syntax.

@Carreau
Copy link
Member

Carreau commented Aug 21, 2020

look at how IPython is doing it:

preprocessing_exc_tuple = None
        try:
            transformed_cell = self.transform_cell(raw_cell)
        except Exception:
            transformed_cell = raw_cell
            preprocessing_exc_tuple = sys.exc_info()

        ...
        elif self.should_run_async(
            raw_cell,
            transformed_cell=transformed_cell,
            preprocessing_exc_tuple=preprocessing_exc_tuple,
        ):
            ...

@lingyunfeng
Copy link

so ,I can only use 'warnings' function.
import warnings
warnings.simplefilter('once')#"error", "ignore", "always", "default", "module"

amanotk added a commit to amanotk/PyTplot that referenced this issue Sep 25, 2020
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. See for reference:
jupyter/notebook#5757
ipython/ipykernel#540

The is just a workaround working with
- python-3.7.9
- jupyter-1.0.0
- ipython-7.18.1
- ipykernel-5.3.4
- tornado-6.0.4
on linux.
@hellodanylo
Copy link

Another workaround is to downgrade IPython to 7.10 until this issue is resolved in IPyKernel

daffidwilde added a commit to daffidwilde/matching that referenced this issue Oct 14, 2020
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.

Details are available under
[this issue](ipython/ipykernel#540).
daffidwilde added a commit to daffidwilde/matching that referenced this issue Oct 15, 2020
* 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.

Details are available under
[this issue](ipython/ipykernel#540).

* Fix ipython version in workflow file.
daffidwilde added a commit to daffidwilde/matching that referenced this issue Oct 15, 2020
* Fix ipython version to avoid warnings. (#126)

* 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.

Details are available under
[this issue](ipython/ipykernel#540).

* Fix ipython version in workflow file.

* Move unmatching inside `second_phase` of SR (#125)

* Move unmatching inside `second_phase`

This was causing simple examples to fail because the second phase of the
algorithm never kicked in. By moving the unmatching, this is avoided,
and is fine because of the corollaries in Irving's paper.

* Add example tests from #124

* Checkout CI file from dev.
@jckling
Copy link

jckling commented Dec 13, 2020

Same problem here

kwant-bot pushed a commit to kwant-project/kwant that referenced this issue Dec 22, 2020
This is a temporary choice due to a bug in IPykernel
ipython/ipykernel#540
@mattpodolak
Copy link

mattpodolak commented Dec 23, 2020

I got this error as well, it seems like if it's triggered once it will print out in every cell afterward.

It first occurred when printing out values from a list:

post_to_comments_list[:10]

All the following cells triggered this warning as well, including this cell:

tst_arr = [1, 2, 3]

@asford
Copy link

asford commented Mar 17, 2021

Does this need a owner? Would a fix for this fit in the 6.0 release timeline?

@Carreau
Copy link
Member

Carreau commented Mar 19, 2021

#605 is not a proper fix, it re-introduces the exact bug that was painfully fixed in CLI IPython.

@Carreau
Copy link
Member

Carreau commented Mar 19, 2021

Sorry it does not reintroduce it, the bug is still there in IPykernel ; it just mute the error message.

ajhynes7 added a commit to ajhynes7/scikit-spatial that referenced this issue Mar 25, 2021
Now the warning level is reset at the end of the context manager.
This was causing a problem on Jupter notebooks,
possibly due to the issue ipython/ipykernel#540.
@gansanay
Copy link

gansanay commented Apr 9, 2021

I am still getting this warning at each cell in jupyterlab. python==3.9.2, ipykernel==5.5.3, ipython==7.21.0.

@cam4ani
Copy link

cam4ani commented Apr 9, 2021

me too

@Carreau
Copy link
Member

Carreau commented Apr 9, 2021

Do you have a file and line number for this warning ? it would be helpful to know which lines trigger it.

@stridera
Copy link

.venv/lib/python3.8/site-packages/ipykernel/ipkernel.py:283: 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)

@gboeing
Copy link

gboeing commented Apr 28, 2021

@Carreau this warning is still appearing with ipykernel=5.5.3, ipython=7.22.0, python=3.9.2:

miniconda3/envs/ox/lib/python3.9/site-packages/ipykernel/ipkernel.py:283: 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)

@Carreau
Copy link
Member

Carreau commented Apr 28, 2021

@Carreau this warning is still appearing with ipykernel=5.5.3, ipython=7.22.0, python=3.9.2:

That appear to be expected, the fix in only on the master branch that will become 6.0.

@gboeing
Copy link

gboeing commented Apr 28, 2021

Ah, thanks. I see now the fix is in #617. Looking forward to it in the 6.0 release.

BoxiLi added a commit to BoxiLi/qutip-notebooks that referenced this issue May 25, 2021
There is a bug in ipykernel 5.5, see ipython/ipykernel#540
BoxiLi added a commit to BoxiLi/qutip-notebooks that referenced this issue May 25, 2021
There is a bug in ipykernel 5.5, see ipython/ipykernel#540
BoxiLi added a commit to BoxiLi/qutip-notebooks that referenced this issue May 25, 2021
There is a bug in ipykernel 5.5, see ipython/ipykernel#540
@vvid643
Copy link

vvid643 commented May 26, 2021

Hi, can anyone help me with installing this commit into my already installed package?

macOS 11.3.1
ipykernel==5.5.5
ipython==7.21.0
Python 3.8.8

BoxiLi added a commit to BoxiLi/qutip-notebooks that referenced this issue May 29, 2021
qutip4.6 requires numpy>=1.16.6,<1.20 and cython>=0.29.20

Add qutip-qip as a dependency

Pin the ipython version because there is a bug in ipykernel 5.5, see ipython/ipykernel#540
kwant-bot pushed a commit to kwant-project/kwant that referenced this issue Feb 3, 2024
This is a temporary choice due to a bug in IPykernel
ipython/ipykernel#540
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.