0

I am running anaconda jupyter notebook on remote ubuntu machine, and I have three separate conda environments.

base                  *  /home/user/anaconda3
dev                      /home/user/anaconda3/envs/dev
pytorch                  /home/user/anaconda3/envs/pytorch

In order to use juypter notebook remote, I am using localhost:8888 for base environment and I want to configure pytorch environment's default port to localhost:8889. such that

c.NotebookApp.port = 8889

But when I attempts

notebook --generate-config

command, it asks me whether to overwrite or not.

Overwrite /home/user/.jupyter/jupyter_notebook_config.py with default config? [y/N]

Is there any way that I can generate jupyter config file for pytorch conda environment independent from base conda environment?

doyouknowkimchi
  • 165
  • 3
  • 12

1 Answers1

1

You can probably add some logic into the config (untested):

from os import environ
cenv = environ['CONDA_DEFAULT_ENV']
if 'pytorch' in cenv:
    c.NotebookApp.port = 8889
Jus
  • 504
  • 3
  • 11