korniichuk / rk

The remote Jupyter kernel/kernels administration utility
http://www.korniichuk.com
The Unlicense
54 stars 18 forks source link

Python3.5 and local installs #10

Open leguyader opened 8 years ago

leguyader commented 8 years ago

While trying to use rk, I run into the following problems:

module_location = join(getusersitepackages(), module_name)

Did it work eventually ? Nope. Now I'm facing an strange issue. I can ssh into the remote machine without being asked for passphrase or password since the authentication is based on kerberos. Strangely enough, rk asks me first my passphrase, then my password and both eventually fail. Not sure what's causing this. Here is part of the log:

[I 12:04:27.899 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel a251e120-4f06-485e-938f-5e60c1e11505 restarted
/usr/lib/python3.5/getpass.py:92: GetPassWarning: Can not control echo on the terminal.
  passwd = fallback_getpass(prompt, stream)
Warning: Password input may be echoed.
remote's password: Traceback (most recent call last):
  File "/usr/lib/python3.5/getpass.py", line 70, in unix_getpass
    old = termios.tcgetattr(fd)     # a copy to save
termios.error: (25, 'Inappropriate ioctl for device')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "~/.local/bin/rkscript", line 230, in <module>
    paramiko_tunnel(v, remote_ports[k], remote_username_at_remote_host)
  File "~/.local/lib/python3.5/site-packages/rk/ssh/tunnel.py", line 321, in paramiko_tunnel
    password = getpass("%s's password: "%(server))
  File "/usr/lib/python3.5/getpass.py", line 92, in unix_getpass
    passwd = fallback_getpass(prompt, stream)
  File "/usr/lib/python3.5/getpass.py", line 127, in fallback_getpass
    return _raw_input(prompt, stream)
  File "/usr/lib/python3.5/getpass.py", line 149, in _raw_input
    raise EOFError
EOFError
[5897] Warning: unhandled RemoteError: Traceback (most recent call last):
  File "<string>", line 1072, in executetask
  File "<string>", line 1, in do_exec
  File "<remote exec>", line 55, in <module>
PermissionError: [Errno 13] Permission denied: '~/.ipython/profile_default/security/kernel-a251e120-4f06-485e-938f-5e60c1e11505.json'

Cheers.

leguyader commented 8 years ago

Here some more infos.

First of all, I'm not sure why paramiko is used on my linux local machine. Reading the code in ssh/tunnel.py seems to suggest using it only on win32. Anyway, to get paramiko working with kerberos atuhentication, I modified in ssh/tunnel.py two lines in _try_passwordless_paramiko and in _paramiko_tunnel functions the call to client.connect by adding the argument gss_auth=True

This made things work. However, the remote machine I'm using are part of a pool of machines. If I configure the kernel.json with the pool name which then randomly redirect to a machine with low load, things don't quite work. If I modify the kernel.json to use the name of a specific machine in the pool, things work perfectly. I suspect that with the general pool name, several connections are made and each end up on a different machine, messing things up.

Cheers.