Reputation: 45752
I am trying to run Jupyter in a conda virtual environment. I have activated my environment and if I run python from the terminal it runs the virtual environment correctly.
However if I launch jupyter from within my virtual environment (by opening a Windows command prompt, typing conda activate hqb-api2
and then jupyter lab --no-browser
), the .ipynb files are running a kernel using the base python installation rather than the virtual environment. You can see this by printing sys.prefix
:
However, if I launch a terminal in Jupyter instead of a .ipynb file, then it correctly uses the virtual environment:
lastly, here is a subsection from pip list
showing the relevant jupyter packages:
What am I doing wrong?
Upvotes: 0
Views: 1906
Reputation: 1842
As per this documentation: Installing the IPython kernel
However, if you want to use a kernel with a different version of Python, or in a virtualenv or conda environment, you’ll need to install that manually
Executing the following command will fix the issue.
python -m ipykernel install --user
Upvotes: 2