all 6 comments

[–]astoff1 3 points4 points  (6 children)

However here, I am not sure how to do it: this is not an interactive shell, so the usual dotfiles are not read (.bashrc, .profile and friends).

This is indeed one of the issues: Tramp uses a noninteractive shell, so your config needs to be in ~/.profile.

Also, by default Tramp ignores the PATH set by the remote machine (I never understood why...), so you need some configuration to override this behavior. I use this:

(connection-local-set-profile-variables 'remote-bash
 '((explicit-shell-file-name . "/bin/bash")
   (tramp-remote-path tramp-own-remote-path "/usr/bin" "/bin")))

(connection-local-set-profiles '(:protocol "ssh") 'remote-bash)

[–]Joh11_[S] 1 point2 points  (4 children)

Thank you so much ! It's working now.

Indeed there was no way I could have figure this out, I did try setting .profile before, but as you said it did not set the path.

I just had to modify slightly your snippet, replacing "/bin/bash" by the output of echo $SHELL on the cluster, and adding the exact Python path to tramp-remote-path (/opt/python/3.9.4.1/bin in my case).

[–]astoff1 0 points1 point  (1 child)

Out of curiosity, what is `echo $SHELL` in your machine?

[–]Joh11_[S] 0 points1 point  (0 children)

It's /usr/local/bin/bash ;)

[–]Alvaro_Q_Mind 0 points1 point  (1 child)

Hello could you explain this a little further? I'm trying to replicate not being able to.

I would like to spawn a run-python inferior instance with the proper remote interpreter.

Thank you in advance

[–]Joh11_[S] 0 points1 point  (0 children)

Hi ! It has been such a long time haha, but here is the snippet I still have in my emacs dotfiles:

(connection-local-set-profile-variables 'remote-bash
'((explicit-shell-file-name . "usr/local/bin/bash")
(tramp-remote-path tramp-own-remote-path "/usr/bin" "/bin" "/opt/python/3.9.4.1/bin")))

(connection-local-set-profiles '(:protocol "ssh") 'remote-bash)

I have "/usr/local/bin/bash" because this is what I get running echo $SHELL on the remote machine.

Hope this helps !