Adding a virtual environment to a Jupyter notebook.
02 Mar 2021This is the Python newbie section. So I had a working virtualenv
going, and I could import
with a .py
file, but put all of that in a Jupyter notebook and suddenly nothing could be found.
Ok, so you have to use a kernel with the environment of your virtualenv, which I learned from a much longer and better blog post than what is here. Mercy sakes, this environment stuff in Python is maddening.
So pip install --user ipykernel
to get set up, and
python -m ipykernel install --user --name=myenv
where myenv
is the name of the virtualenv. Then in the Jupyter notebook, Kernel->Change kernel->(select the name of your environment).