6
  • I made a conda environment in my Deep Learning VM. When I ssh to it (clicking SSH button of my instance in the VM instances page) and type source activate <environment_name> it gets activated correctly in the shell.

  • I successfully connect to jupyter lab from my local machine as explained from the docs

How can I use jupyter in a specific conda environment on this VM ?

The accepted way to run jupyter in a specific conda environment seems to be

Activate a conda environment in your terminal using source activate <environment_name> before you run jupyter notebook.

but the Deep Learning VM docs say

A Jupyter Lab session is started when your Deep Learning VM instance is initialized

so that I cannot source activate before the creation of the jupyter lab session.

Any ideas ?

  • run a standard jupyter notebook myself instead of using the jupyter lab provided by the VM ?
  • activate the environment in startup scripts of the VM before the creation of the jupyter lab ?
thomast
  • 122
  • 2
  • 8
  • I have seen some threads([thread1](https://stackoverflow.com/questions/53004311/how-to-add-conda-environment-to-jupyter-lab),[thread2](https://stackoverflow.com/questions/39604271/conda-environments-not-showing-up-in-jupyter-notebook)), where similar concerns have been discussed. I hope that helps. – Digil Dec 25 '18 at 20:34

2 Answers2

2

Please try out the below steps:

  1. source activate < env_name >

  2. conda install ipykernel

  3. ipython kernel install --name < env_name > --user

After this, launch your python code from hub.colfaxresearch.com and select Kernel --> Change Kernel --> < env_name >

Mat
  • 1,440
  • 1
  • 18
  • 38
Rahila T - Intel
  • 832
  • 4
  • 11
0

The only way we've found to make it see all your environments(conda and new python environments) is to run a new jupyter lab instance.

  • When connecting over SSH map the 8888 or any other port instead of 8080 gcloud compute ssh ... -L 8888:localhost:8888
  • After connecting run jupyter lab from console. The default port is 8888.

This is one of the ugliest issues I've seen with GCE so far!

Serhiy
  • 4,357
  • 5
  • 37
  • 53