https://kedro.org/ logo
#questions
Title
# questions
y

Yuchu Liu

11/09/2022, 12:25 PM
Hello #questions! I am running into an issue with
kedro jupyter notebook
. When I try to load it from the terminal, in a virtual environment I setup for kedro, it tries to load extension
kedro,ipython
from a wrong version of Python. As a result, I don't have any kedro specific commas in jupyter notebook. Here is the warning I get when loading a notebook.
Copy code
[I 13:20:49.212 NotebookApp] Kernel started: 21bb83e7-2e5f-4463-a43e-23744ec3ed02, name: kedro_nfr_transactions
[IPKernelApp] WARNING | Error in loading extension: kedro.ipython
Check your config files in /Users/yuchu_liu/.ipython/profile_default
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/logging/config.py", line 544, in configure
    formatters[name] = self.configure_formatter(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/logging/config.py", line 676, in configure_formatter
    c = _resolve(cname)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/logging/config.py", line 90, in _resolve
    found = __import__(used)
ModuleNotFoundError: No module named 'pythonjsonlogger'
I have tried to load kedro from ipython in the terminal using, and it works perfectly fine.
Copy code
%load_ext kedro.extras.extensions.ipython
%reload_kedro .
Does anyone know how to debug this issue? Thank you!
1
@Rabeez Riaz
r

Rabeez Riaz

11/09/2022, 12:29 PM
For context here our conda environment has python 3.9 (not 3.10 like in the traceback). We also verified that the binaries are coming from this correct environment using
which
both from the terminal and within the notebooks. The
%load_ext
works the the ipython shell (not
kedro ipython
) but not in the normal notebook (not
kedro jupyter notebook
)
n

Nok Lam Chan

11/09/2022, 2:14 PM
QQ, which kedro version are you using?
r

Rabeez Riaz

11/09/2022, 2:16 PM
0.18.0 It’s an older project repo, hence the old kedro version and our surprise that kedro jupyter stopped working seemingly overnight. No new packages etc were installed during this time btw. It’s a static environment in that regard
n

Nok Lam Chan

11/09/2022, 2:16 PM
A couple of things: • If you are on
kedro>=0.18.3
- use the alias
%load_ext kedro.ipython
• Try running
jupyter kernelspec list
- and post the output here (do check if there are sensitive info there and mask it if needed)
deleted
y

Yuchu Liu

11/09/2022, 2:28 PM
Copy code
Available kernels:
  kedro_related           /Users/my_name_here/Library/Jupyter/kernels/kedro_related
  python3                 /opt/homebrew/Caskroom/miniconda/base/envs/name_of_env/share/jupyter/kernels/python3
n

Nok Lam Chan

11/09/2022, 2:28 PM
And which env are you using?
y

Yuchu Liu

11/09/2022, 2:29 PM
lower one
oh well, i tried both 🙂
n

Nok Lam Chan

11/09/2022, 2:31 PM
Are you using conda, JupyterHub or something else?
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/logging/config.py”
from your error this python path is very different from what you shown above.
I am running into an issue with
kedro jupyter notebook
. When I try to load it from the terminal, in a virtual environment I setup for kedro, it tries to load extension
kedro,ipython
from a wrong version of Python
Assume you are using the
kedro_related
enviornment and running
kedro jupyter notebook
, do you click on the UI and choose the kernel (
kedro_related
)?
y

Yuchu Liu

11/09/2022, 2:35 PM
Yes
n

Nok Lam Chan

11/09/2022, 2:37 PM
Yes to which question?😅
y

Yuchu Liu

11/09/2022, 2:37 PM
do you click on the UI and choose the kernel (
kedro_related
)?
yes, i did click on the UI and choose the kernel (kedro_related)
n

Nok Lam Chan

11/09/2022, 2:38 PM
hmmm, just check on one thing. Instead of using
kedro jupyter notebook
, what happens if you use
kedro ipython
, does it loads everything correctly?
y

Yuchu Liu

11/09/2022, 2:38 PM
I am using conda, and I am in an active virtual environment with Python 3.9 installed. therefore it makes no sense to me at all that kedro is trying to load anything from python 3.10
and yes, everything load correctly in kedro ipython
n

Nok Lam Chan

11/09/2022, 2:40 PM
This is likely a jupyter issue
can you try this
Let’s assume you use
kedro_related
env for now
Copy code
conda activae kedro_related
jupyter kernelspec remove kedro_related
kedro jupyter notebook
And check that on your Jupyter Notebook it is using the targeted kernel - on the top right
If it’s still not working - can you share the full log when you fire up
kedro jupyter notebook
y

Yuchu Liu

11/09/2022, 2:44 PM
now kedro specific command works in notebook, after these two steps
Copy code
jupyter kernelspec remove kedro_related
kedro jupyter notebook
n

Nok Lam Chan

11/09/2022, 2:44 PM
can you rerun
jupyter kernelspec list
y

Yuchu Liu

11/09/2022, 2:45 PM
returns the same as before
Copy code
Available kernels:
  kedro_related           /Users/my_name_here/Library/Jupyter/kernels/kedro_related
  python3                 /opt/homebrew/Caskroom/miniconda/base/envs/name_of_env/share/jupyter/kernels/python3
n

Nok Lam Chan

11/09/2022, 2:46 PM
This is weird - but at least now it works
😅 1
y

Yuchu Liu

11/09/2022, 2:46 PM
🙂 maybe i should delete the kernel everytime
n

Nok Lam Chan

11/09/2022, 2:46 PM
This usually happens because the 1st time someone run
kedro jupyter notebook
on that machin, it is in the incorrect conda enviornment and it is registered in the kernel.
But your output
jupyter kernelspec list
doesn’t seem to support that, although it works now😅
On newer version we re-created the kernel automatically, but probably not in
0.18.0
🥳 2
y

Yuchu Liu

11/09/2022, 2:47 PM
it is not the first time i am running the notebook from kedro on this machine, some ghosts maybe...
but to be safe i should just re-create the kernel every time
n

Nok Lam Chan

11/09/2022, 2:48 PM
But yes, if it happens just remove the kernel again as a temporary solution.
y

Yuchu Liu

11/09/2022, 2:48 PM
alright, thank you
n

Nok Lam Chan

11/09/2022, 2:50 PM
Or just upgrade 😁 we’ll add more cool stuff for the Jupyter interactive workflow
🥳 1
y

Yuchu Liu

11/09/2022, 2:50 PM
thanks a lot!
r

Rabeez Riaz

11/09/2022, 2:51 PM
@Nok Lam Chan unrelated but is there a tracker for the upcoming jupyter workflow? Would love to keep an eye out for them
n

Nok Lam Chan

11/09/2022, 3:00 PM
@Rabeez Riaz Sure! Not so much on a release timeline. In general we have a milestone on GitHub. In the
0.18.x
series so far I think there are couple changes • alias
%load_ext kedro.ipython
• A better
%reload_kedro
magic that accepts parameters • Enabled rich logging in notebook • Couple fix to make it works better on Databricks. https://github.com/kedro-org/kedro/issues?q=is%3Aopen+is%3Aissue+milestone%3A%22Improve+the+Interactive+Jupyter+notebook+workflow%22
👍 1
6 Views