问题
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:
source activate < env_name >
conda install ipykernel
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