I want to connect to remote ipython server, and follow the doc of the ipython, I start a ipython server in my server by

ipython3 kernel -f ~/.ipython/kernel.json --pprint

and I can start a ipython client in iTerm by

jupyter console --existing path/to/kernel.json --ssh [email protected] -simple-prompt

However, I use the above command in emacs by run-python and got

Warning (python): Python shell prompts cannot be detected.
If your emacs session hangs when starting python shells
recover with ‘keyboard-quit’ and then try fixing the
interactive flag for your interpreter by adjusting the
‘python-shell-interpreter-interactive-arg’ or add regexps
matching shell prompts in the directory-local friendly vars:
  + ‘python-shell-prompt-regexp’
  + ‘python-shell-prompt-block-regexp’
  + ‘python-shell-prompt-output-regexp’
Or alternatively in:
  + ‘python-shell-prompt-input-regexps’
  + ‘python-shell-prompt-output-regexps’

The solution in here does not work for me and even if it does, it seems that one can not send code to this *Python* buffer.

So my question is how can I use a remote ipython console and send by codes by python-shell-send-* functions ?

Thanks in advance.

  • Would it be OK to have Emacs start a remote ipython server, or do you have explicit reasons why you need to connect to an existing one?
    – Daniel
    Commented Apr 13, 2017 at 18:34
  • @dangom I want to eval the python buffer in a remote powerful machine rather than my local MacBook. Commented Apr 14, 2017 at 1:59

1 Answer 1


In order to use remote python session, the python file should be on the remote server, and you should call run-python while editing the remote file via tramp. Then python-shell-send-* should work properly.

The reason is, python-shell-send-* will write the code to a tmpfile and then ask the python shell to execute the tmpfile, which needs to be on the same server as the python session.

I've found M-x run-python works without problem for me when editing a remote file via tramp. Connecting to an existing session via (run-python "jupyter console --existing --simple-prompt") also works, it prints the ugly Warning message you posted but is fully functional.

  • "it prints the ugly Warning message you posted but is fully functional." - does it print Python shell prompts cannot be detected.... or Your `python-shell-interpreter' doesn't seem to support readline, yet `python-shell-completion-native-enable'...? I wouldn't expect something functional after the first warning. The second can be suppressed by customizing python-shell-completion-native-disabled-interpreters.
    – npostavs
    Commented Apr 18, 2019 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.