1

When working on a Python file with VSCode a new integrated terminal automatically activates the virtual environment from which I have chosen the Python interpreter. I find this to be very useful and I wanted to know if it's possible to do the same with Jupyter Notebooks.

If I select a specific virtual environment as my Jupyter kernel and open a new terminal, this will not activate the virtual environment. I thought there could be some command like "jupyter.terminal.activateEnvironment": true (if that makes sense?) but haven't been able to find anything.

Is there anything close to this? I'm very new to VSCode so some things I say might not be correct... Happy to learn more and thanks for any help!

BB3C
  • 61
  • 6

1 Answers1

0

What do you mean with "select a specific virtual environment as my Jupyter kernel"? The procedure to install Jupyter in an environment is documented here: Kernels for different environments

source activate myenv
pip install ipykernel
python -m ipykernel install --user --name myenv --display-name "Python (myenv)"

Finally, select the registered kernel "Python (myenv)" in VSCode and you're done.

Peter
  • 10,959
  • 2
  • 30
  • 47
  • I have this already set up and I installed Jupyter in the virtual environment without any problems. Thing is that if I open a folder from VSCode with a .ipynb file in it and select the kernel, a new integrated terminal won't activate the environment. This works however if I were using a .py file instead where I specify the interpereter. – BB3C Jul 30 '22 at 17:28