TL;DR
- Identify path of R module:
module show R/3.0.1
- add to your .emacs:
(add-to-list 'tramp-remote-path "/path/to/R-3.0.1/bin")
bash called by TRAMP via ssh does execute its initialization files but which files ultimately get executed depends on several things. You can check if your ~/.bashrc
gets executed at all when you use TRAMP to connect to the server by adding something like echo "bashrc here"
to the file. Then set variable
(setq tramp-verbose 9)
and try connecting. Now see if you can spot that message in a buffer called *debug tramp/ssh...*
.
If you don't have any additional settings, TRAMP calls remote shell as /bin/sh
(http://www.gnu.org/software/tramp/#Remote-shell-setup) so bash
will execute /etc/profile
and ~/.profile
(http://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html#Bash-Startup-Files). You can also see how the shell is called in that *debug tramp/ssh...*
buffer, the relevant line will be
tramp-open-shell (5) # Opening remote shell `/bin/sh'...done
Try adding the module load R/3.0.1
to ~/.profile
first. If that does not help, try forcing TRAMP to call bash
by its proper name by setting
(setq explicit-shell-file-name "bash")
(setq shell-file-name "bash")
UPDATE: If all else fails, you can just open shell M-x shell
, then ssh to you server which should take care of the proper modules initialization (because you mentioned that interactive ssh connection works as expected). Once on the server, launch R and then do M-x ess-remote
to make ESS aware of existing R session. This way you don't rely on TRAMP at all.