Jupyter nb output in PyCharm IDE breaks with Kedro 0.18.2
See original GitHub issueDescription
Jupyter notebook cell output related to the logging package and pandas package in the IDE Pycharm >= 2022.1.2 renders as a web file instead of an interactive ‘Table’ after upgrading from kedro 0.18.1 to 0.18.2. My hypothesis is that this is caused by the native integration of the Rich package as of kedro 0.18.2. Current resolution is to remain at kedro 0.18.1 for time being, hoping this issues is fixed in a future release.
Code run prior to the outputs in the image below:
import numpy as np
import pandas as pd
from kedro.framework.cli import catalog
%load_ext kedro.extras.extensions.ipython
%reload_kedro D:\Work\vz-ona-kedro
df = catalog.load("node_dataset").head(5)
df.columns = ['Example'+str(idx) for idx, _ in enumerate(df.columns) ]
*Outputs as of 0.18.2 *Output types types as of 0.18.2 *Outputs in 0.18.1 *Output Types in 0.18.1
Context
Pycharm version >= 2022.1.2 Upgrade from Kedro 0.18.1 to 0.18.2 caused issue. Downgrade resolves issue. Jupyter cell outputs as a result of the logging package and pandas package render as ‘Web’ instead of Text / Table. After outputting, cells might become unresponsive to editing for +/- 15 seconds.
Works fine in the browser version of Jupyter, however this does not have the functionality of an IDE, impacting productivity.
Steps to Reproduce
- Upgrade to Kedro 0.18.2 from 0.18.1
- Run notebook cell that outputs a pandas dataframe, stacktrace or logs
Expected Result
Output of cell is of type ‘Table’ and renders as an interactive table
Actual Result
Output of cell is of type Web, and is non-interactive
Your Environment
Include as many relevant details about the environment in which you experienced the bug:
- Kedro version: 0.18.2
- Python version: 3.8.13
- Operating system and version: Windows 10 Home 21H2
- Pycharm version >= 2022.1.2
Project Dependencies installed:
networkx~=2.5 plotly==5.9.0 pandas~=1.3.0 numpy~=1.22.3 holidays==0.11.3.1 tqdm~=4.56.0 python_dateutil==2.8.2 python-pptx==0.6.21 kaleido==0.2.1 scipy==1.7.3 Pillow~=8.4.0 python-dateutil~=2.8.1 kedro~=0.18.1 sphinx~=5.0.1 pyarrow~=6.0.1
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
Thanks for letting us know @CraftingLevi. Just to check: if you comment out these lines:
and still have
rich
configured as the logging handler (easiest way to ensure this is just to delete your conf/base/logging.yml file), then things work ok in PyCharm Jupyter?I wouldn’t raise a PR for this just yet since we’re going to need to have think about the right solution. There could be a few different ways to approach this I think, and we’ll need to take a bit of time to figure out what the best way is. But thank you for the offer!
Thanks for the quick response! I looked further into it, and it seems that rich and PyCharm just don’t go hand in hand and found related issues on the JetBrains end.
I did some digging and found the root cause for the issues in PyCharm This issue specifically is a result of calling rich.traceback.install and rich.pretty.install in kedro/kedro/framework/project/init.py. Commenting these out resolves all jupyter notebooks issues in PyCharm, and does not cause further issues in Kedro.
A resolution would be to rollback the decision on default_logging and continue use of the logging.yml file in conf/base, whilst setting the default to rich regardless, but providing end-users the option to use a different type of logging opposed to rich, in situations where rich might skrew with the dev environment.
For now, I’ll rollback to 0.18.1. I’m new to contributing, so let me know what a good approach would be to get the suggestion above reviewed.