2

I have got two anaconda environments. The base one and my testing environment called testenv. This environment works without an issue for example with the PyCharm IDE.

enter image description here

When starting a jupyter server straight from the pictured directory by issuing jupyter notebook my scripts/notebooks complains about missing packages.

This tells me it is using base environment instead of my testenv environment. But as the screenshot show, its not the one thats activated.

So the question is: How can I set the virtual environment used by jupyter?

Used versions:

  • Windows 10 Pro x64
  • Jupyter Notebook 5.7.4
  • Python 3.7.1
  • Conda 4.5.12

[Edit] It turned out that jupyter was not even installed in my environment. I was assuming to be able to use the installation coming from base. After installing jupyter within my environment everything was working as expected.

Matthias Güntert
  • 4,013
  • 6
  • 41
  • 89
  • To begin using a virtual environment, it needs to be activated first. Hot "switching" never happens. Say if you have a program written in `env-1` and you switch to `env-2` then reopening that program in `env-2` might complain about certain dependencies that were only available in `env-1` – nabster Jan 25 '19 at 22:15

2 Answers2

1

This is usually foolproof for me. However, it does not allow switching virutal env on the fly. Conda docs.

Windows

$ activate testenv
$ jupyter notebook

Linux

$ source activate testenv
$ jupyter notebook
Scott Skiles
  • 3,647
  • 6
  • 40
  • 64
1

If you'd like to be able to switch between your envs even on the fly from within Jupyter, this should also do the trick.

How do I add python3 kernel to jupyter (IPython)

SimonR
  • 117
  • 1
  • 8