I'm using Remote-SSH (Visual Studio Code Remote - SSH) in Visual Studio Code to connect to a server on which I write and run Jupyter notebooks.
I am trying to use a library which requires some environment variables to be set by running source env.profile
I tried putting source env.profile
into one of the files in $ZSH_CUSTOM
which are sourced on startup by ZSH. With this, the file is correctly sourced in the interactive terminal in the panel.
However it seems that notebooks (and for that matter regular python files) in Visual Studio Code are run inside of a different shell altogether. And that shell doesn't seem to source the same files as ZSH.
After reading this issue I tried adding the source line in various files mentioned there, with no change.
I also tried simply running ! . env.profile
inside a cell in the notebook, and it also doesn't work.
Finally I tried using jupyter.runStartupCommands
mentioned here but that also didn't work. This makes sense since as far as I know these startup commands are strictly equivalent to running the code inside a cell directly as the very first thing in your notebook