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

Tracebacks not working properly within notebooks when using kedro ipython extension #2260

Closed
MatthiasRoels opened this issue Jan 26, 2023 · 2 comments
Labels
Community Issue/PR opened by the open-source community

Comments

@MatthiasRoels
Copy link

Description

After upgrading kedro to v0.18.4 along with other packages (such as ipython and jupyterlab), we noticed as issue with tracebacks no longer showing up properly in notebooks. This issue was already reported here: Textualize/rich#2271 and was fixed in a newer version of rich. The issue should this be resolved by bumping the version of rich in kedro's requirements.

Context

Because of this issue, only the exception is printed without a traceback. So it is really hard to pinpoint exactly where the error comes from. Instead of a proper traceback, this is the type of error you would see:

tmp/ipykernel_1565558/3782956317.py:1 in <cell line: 1>                                                                                          
 [Errno 2] No such file or directory: '/tmp/ipykernel_1565558/3782956317.py'

Steps to Reproduce

  1. Open jupyter notebooks/lab or you could even open a notebook with your IDE (if supported, e.g. VSCode).
  2. Then create a cell with the following snippet:
import kedro 

%load_ext kedro.extras.extensions.ipython
%reload_kedro $PROJECT_ROOT

params = context.params
params['and_what_about_a_key_that_does_no_exist']
  1. You would see something like:
/tmp/ipykernel_29366/1308041660.py:1 in <cell line: 1>
[Errno 2] No such file or directory: '/tmp/ipykernel_29366/1308041660.py'

Your Environment

We run everything in a Docker container (python:3.10-slim)

  • Kedro version used (pip show kedro or kedro -V): v0.18.4
  • Other packages (only relevant ones are shown):
    • rich==12.6.0
    • ipython==8.8.0
    • ipykernel==6.20.2
    • jupyter-client==7.4.9
    • jupyter-core==5.1.5
    • jupyter-server==2.1.0
    • jupyterlab==3.5.3
    • jupyterlab-server==2.19.0
    • nbclassic==0.4.8
    • notebook==6.5.2
@MatthiasRoels MatthiasRoels changed the title Tracebacks not working proprely within notebooks when using kedro ipython extension Tracebacks not working properly within notebooks when using kedro ipython extension Jan 26, 2023
@merelcht merelcht added the Community Issue/PR opened by the open-source community label Jan 26, 2023
@antonymilne
Copy link
Contributor

Hi @MatthiasRoels, thanks very much for raising the issue. Our rich requirement has already been bumped to ~=13.2 and so this should be reflected when Kedro 0.18.5 is released (within the next couple of weeks I believe): https://github.com/kedro-org/kedro/blob/main/dependency/requirements.txt#L18.

Until then, you should still be able to do pip install -U rich to bump your version of rich locally. Hopefully that fixes it.

P.S. soon we will have a better way for users to disable rich tracebacks in Jupyter notebooks in case there's any further issues with them.

P.P.S. you don't need to import kedro before loading the IPython extension. There's also a shorter alias for it now: just %load_ext kedro.ipython will work.

@MatthiasRoels
Copy link
Author

MatthiasRoels commented Feb 1, 2023

Thanks for the reply! Will update as soon as 0.18.5 comes out then.

As far as I’m concerned, you can close the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Issue/PR opened by the open-source community
Projects
Archived in project
Development

No branches or pull requests

3 participants