How to run jupyter lab in a conda environment on a google compute engine (Deep Learning VM)?

烂漫一生 提交于 2020-12-01 11:01:04

问题


  • 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 ?

回答1:


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 >




回答2:


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!



来源:https://stackoverflow.com/questions/53923773/how-to-run-jupyter-lab-in-a-conda-environment-on-a-google-compute-engine-deep-l

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!