ncar-xdev / jupyter-forward

Launch Jupyter Lab over SSH with a single command!
https://jupyter-forward.readthedocs.io/
Apache License 2.0
31 stars 12 forks source link

Do we need to require a user to have conda configured in rc files? #143

Open mnlevy1981 opened 2 years ago

mnlevy1981 commented 2 years ago

On some systems, it makes sense for users to rely on system python and only use conda for certain tasks. E.g. someone who spends a lot of time running old code may want a default environment that uses python 2, and rather than set up (base) in that manner is content to use the out-of-the-box python environment.

I removed the conda initialization from my .tcshrc file on the VM where I test using tcsh, and when I try to use jupyter-forward to connect I get and error about being unable to find jupyter:

$ jupyter-forward VMtcsh
********************************************** Authenticating **********************************************
Authenticating user (mlevy) from client (cgdm-chaohu) to remote host (localhost)
✅ The client is authenticated successfully
***************************************** Verifying shell location *****************************************
✅ Using shell: /bin/tcsh
************************************** Running jupyter sanity checks ***************************************
/bin/tcsh -c "which jupyter"
jupyter: Command not found.
*************************** ❌ Terminated the network 📡 connection to localhost ***************************

Is there some way to catch that the issue is actually that I commented out

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
if ( -f "$CONDA_PREFIX/etc/profile.d/conda.csh" ) then
    source "$CONDA_PREFIX/etc/profile.d/conda.csh"
else
    setenv PATH "$CONDA_PREFIX/bin:$PATH"
endif
# <<< conda initialize <<<

(note that $CONDA_PREFIX is not defined without sourcing that file). One possible solution would be to pass an optional --conda-location argument; between that argument and self.shell maybe it would be possible to load conda before trying to do anything else?

mnlevy1981 commented 2 years ago

Relatedly, does jupyter-forward support having a configuration file somewhere on the remote machine? It seems like that would be a good place to store the value for --conda-location instead of aliasing the command or having to provide it every time you try to connect.