gcv / julia-snail

An Emacs development environment for Julia
GNU General Public License v3.0
231 stars 21 forks source link

Adding sshx for tramp #125

Closed kadir-gunel closed 11 months ago

kadir-gunel commented 11 months ago

Hello, I am struggling to connect tramp via ssh but I can do sshx without any problems. I searched and configured ton of stuff. And no hope with ssh. I saw above that you added scp and scpx. Is it possible for you to add sshx as well ? Or are there any problems with sshx ?

B.R.

Originally posted by @kadir-gunel in https://github.com/gcv/julia-snail/issues/120#issuecomment-1641863386

gcv commented 11 months ago

A little local testing didn't turn up any problems for me with sshx, so I just whitelisted it (commit 18b891b4). It should reach MELPA in a couple of hours.

Please try it out and let me know if it works for you.

kadir-gunel commented 11 months ago

Thank you for quick response.

Now, I can cal julia-snail on remote. But, it keeps telling me to set the julia-snail-executable which I did; on both machines the path for executable is same (/usr/local/bin/julia). I read the readme file of yours and probably the reason for not calling julia on remote is that I am using fish shell with tmux (both local and remote). And I am paying the price right now :)

I don't know if you are familiar with tramp but I also set the remote shell by using the (setq tramp-default-remote-shell "/usr/bin/bash"). Still no hope.

Do you have any solution for this?

kadir-gunel commented 11 months ago

For some reason, I managed to connect to remote using ssh. All I have to do is to add inside config.fish file :

if test "$TERM" = "dumb"
    exec sh
end

Then I managed to connect to the remote server. But still I am getting ....; double-check julia-snail-executable path error/warning.

And I think I don't understand the lines in your readme :

NB: It is simpler to set julia-snail-executable in your project to the Julia binary’s absolute path than to wrangle your shell path. This section gives a bit of assistance if you disregard this advice.

A subtle problem may occur if julia-snail-executable is set to a value you expect to find on the remote host’s shell path. When Snail connects to the remote host using SSH, it will launch Julia in a non-interactive, non-login shell. This means that, depending on (1) your remote shell, (2) how you set your path, and (3) which shell startup files you rely on, the path may not be what you have in your ordinary remote shell sessions.

Zsh: .zshenv is always executed; .zshrc is only executed by interactive shells. Make sure you set your path in .zshenv. Bash: .bashrc is only executed by non-interactive shells; .bash_profile is only executed by interactive shells. To run your setup regardless of shell type, put everything in .bashrc and source .bashrc from .bash_profile.

Could you help ?

gcv commented 11 months ago

That part of the readme is for people who want to pick up the location of julia from the remote shell’s path, and it gives hints about how to configure the remote shell appropriately. Path setup for different types of shells is surprisingly complex, and I think setting up julia-snail-executable in your remote project’s .dir-locals.el is much easier.

Please follow the debugging steps here: https://github.com/gcv/julia-snail/issues/120#issuecomment-1524731711

kadir-gunel commented 11 months ago

I copied and pasted as a comment inside "remote".jl file and it returned me :

ssh -t -L 10011:localhost:10011 phd@192.168.1.133#52347 /usr/local/bin/julia -L /tmp/julia-snail-d8f1d20ea24483f4e15d0b570cacc558958544c70dc1ddd6bdfc7be94ef1d7fe/JuliaSnail.jl"

Then copied and pasted this line to iterm and immediately it connected to remote shell's tmux session without opening Julia's REPL. Strangely, when I detach it from tmux session I am able to open remote REPL. So the problem is caused by tmux then, right? Is there any trick to bypass it ?

I also created a .dir_locals.el file under project folder and wrote : (setq julia-snail-executable "/usr/local/bin/julia") but I still cannot run remote Julia repl.

gcv commented 11 months ago

It certainly looks like tmux is causing the problem. Is it being launched by a RemoteCommand section in your .ssh/config file? If so, then maybe try adding -o RemoteCommand=none to the ssh invocation above and see if it helps.

kadir-gunel commented 11 months ago

I started from scratch. And now, I am able to C-c C-z for remote calling. And I can see all my tmux session. I actually hijack tmux-session from my terminal screen into emacs. But when calling C-c C-z, it does not call Julia binary and execute it.

What I do is pretty strange. I re-attach my tmux-session in terminal, then call Julia. Until I call Julia manually I cannot do anything on emacs. And when I see Julia REPL inside emacs I cannot send lines (C-c C-l) but I can C-c C-z. Also it warns me : channel 3: open failed: connection failed: Connection refused

Any suggestions such as attaching file to repl ? Because it tells me : Buffer *Julia* process has no process

gcv commented 11 months ago

You need to get tmux out of the picture. It’s not supported for remote Snail Julia REPLs. That may happen in the future, but the work is not currently planned.

tmux is clearly set up in your remote environment to automatically start (or connect to an existing session). Please double-check your .ssh/config file and your shell startup scripts for what could be causing it to start. Maybe try running ssh with the -vv flag (verbose mode) to see what’s going on and what SSH is doing when it connects.

kadir-gunel commented 11 months ago

thank you very much for everything.