Elpy: fix_code_with_yapf throws timeout during RPC call

Created on 15 Jun 2016  Â·  2Comments  Â·  Source: jorgenschaefer/elpy

When I use C-c C-r f to reformat the buffer, no re-formatting appears to happen and I get this error in the minibuffer:

Timeout during RPC call fix_code_with_yapf from backend

Weirdly, I have things configured to format the buffer on save with yapf, and _that_ seems to work, but manually kicking the formatter doesn't.

This was working as of a few days ago, and now it seems to be not working (there may have been upgrades of one or more related packages in the meantime). Is there anything you can suggest to help me track down more info about what's going on here and where the problem might lie?

Output from elpy-config

Virtualenv........: None
RPC Python........: 3.5.1 (/usr/local/bin/python3)
Interactive Python: /usr/local/bin/ipython3 (/usr/local/bin/ipython3)
Emacs.............: 25.0.95.1
Elpy..............: 1.12.0
Jedi..............: 0.9.0
Rope..............: 0.10.3
Importmagic.......: 0.1.7
Autopep8..........: 1.2.4
Yapf..............: 0.10.0
Syntax checker....: flake8 (/usr/local/bin/flake8)

You have not activated a virtual env. While Elpy supports this, it is often a
good idea to work inside a virtual env. You can use M-x pyvenv-activate or M-x
pyvenv-workon to activate a virtual env.

The directory ~/.local/bin/ is not in your PATH. As there is no active
virtualenv, installing Python packages locally will place executables in that
directory, so Emacs won't find them. If you are missing some commands, do add
this directory to your PATH.

Emac exec-path is:

("/usr/local/bin" 
 "/usr/local/sbin"
 "/usr/bin"
 "/usr/sbin"
 "/bin"
 "~/bin"
 "/Applications/Emacs.app/Contents/MacOS/libexec"
 "/Applications/Emacs.app/Contents/MacOS/bin"
 "/usr/local/Cellar/emacs-mac/HEAD/libexec/emacs/25.0.95/x86_64-apple-darwin15.5.0"
 nil)

Config in my init is as follows -- I use the Emacs starter-kit, so elpy is being installed via package and auto-loaded from the package directory.

(starter-kit-install-if-needed 'elpy 'flycheck 'py-autopep8 'py-yapf)
(elpy-enable)
(setq elpy-modules '(elpy-module-company
                     elpy-module-eldoc
                     elpy-module-pyvenv
                     elpy-module-yasnippet
                     elpy-module-sane-defaults))
(setq elpy-rpc-python-command "/usr/local/bin/python3")
(elpy-use-ipython "/usr/local/bin/ipython3")
(require 'py-yapf)
(add-hook 'elpy-mode-hook 'py-yapf-enable-on-save)

All the non-emacs utilities are installed via homebrew on OSX (10.11.5) and/or with pip3.5.

Question

Most helpful comment

Bah. Increasing the number of seconds for elpy-rpc-timeout to 10 addressed this, so I suspect this is just down to having a default timeout value that's a bit conservative (1).

All 2 comments

Bah. Increasing the number of seconds for elpy-rpc-timeout to 10 addressed this, so I suspect this is just down to having a default timeout value that's a bit conservative (1).

Heh, glad it works now.

Yes, the default timeout is a bit weird. Especially in these cases, because in interactive calls that block, there is no need for a timeout at all …

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mfcabrera picture mfcabrera  Â·  6Comments

kapilsh picture kapilsh  Â·  3Comments

Valber picture Valber  Â·  4Comments

CDitzel picture CDitzel  Â·  5Comments

rakanalh picture rakanalh  Â·  5Comments