Hello <#C03RKP2LW64|questions>! I am running into ...
# questions
y
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
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
QQ, which kedro version are you using?
r
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
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
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
And which env are you using?
y
lower one
oh well, i tried both 🙂
n
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
Yes
n
Yes to which question?😅
y
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
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
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
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
now kedro specific command works in notebook, after these two steps
Copy code
jupyter kernelspec remove kedro_related
kedro jupyter notebook
n
can you rerun
jupyter kernelspec list
y
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
This is weird - but at least now it works
😅 1
y
🙂 maybe i should delete the kernel everytime
n
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
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
But yes, if it happens just remove the kernel again as a temporary solution.
y
alright, thank you
n
Or just upgrade 😁 we’ll add more cool stuff for the Jupyter interactive workflow
🥳 1
y
thanks a lot!
r
@Nok Lam Chan unrelated but is there a tracker for the upcoming jupyter workflow? Would love to keep an eye out for them
n
@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