Kernels

To add existing environment as a jupyter kernel:

List kernels

jupyter kernelspec list

Remove kernel

jupyter kernelspec remove <kernel-name>  

Install new kernel

ipython kernel install --name <local-venv> --user
is_jupyter = get_ipython().__class__.__name__ == 'ZMQInteractiveShell'
is_jupyter
True

Add default path(s) to sys.path

To make sure path is always available in the jupyter kernel do the following (taken from here):

ipython profile create
ipython locate

/Users/username/.ipython

cd /Users/username/.ipython
vi profile_default/ipython_config.py

add these lines (use i to enter insert mode and Esc to exit, save and quit as :wq:

c.InteractiveShellApp.exec_lines = [
    'import sys; sys.path.append("/path/to/your/module")'
]

sys.path can be different in python env and jupyter kernel. The solution that worked is here, in short, one has to compare the sys.executable for both the environment AND jupyter kernel (this one is listed using jupyter kernelspec list and looking into relevant kernel.json file) a must-read that I still need to go over is here here.

Change the default kernel

jupyter notebook --generate-config

In jupyter config file modify and uncomment following line: c.MultiKernelManager.default_kernel_name='newDefault' \n"