I am trying to use the elpy python package by putting it in my dotemacs file. But, when I fire up an emacs session and type inside the source code frame ( I don't split any frames ), I get the following messages in sequence with the first one going away very quickly so it's hard to read.

First message:

Elpy is trying to create RPC virtualenv /home/markleeds/emacs.d/elpy/rpc-env

Second message:

error in process sentinel: peculiar error: "exited normally with code 1


Note that these error messages are in many threads on the internet so I'm thinking that someone may have seen it before. I'm so inexperienced with emacs usage ( I always just used it in a very basic way until recently when I started working on modifying it ) that, when I go through the threads with the identical messages, I can't even tell if a solution was found.

If it is a mistake to send this here and I should instead send it to the python stackexchange list, then my apologies and I will do that.

Note that, if I do, emacs --debug-init sieve.py, I don't get any messages at the bottom until I start typing and then I get the messages above.

The link that I am trying to follow is https://realpython.com/emacs-the-best-python-editor. Thanks for your help and, if I made mistakes in explaining my problem, I'm all ears and apologize in advance.

P.S: I am using ubuntu 20.04, python 2.7.18 and emacs 27.2.

2 Answers 2


I had that problem and found this link which suggested doing M-x elpy-rpc-reinstall-virtualenv. That worked for me and it also seems to have worked for a few other people. Try it and see if it works for you.

  • 1
    Hi NickD. I'll try that. I'm currently upgrading Ubuntu to 21.10 because my ubuntu version is not in line with the latest version of Python. Thanks and I'll let you know how your suggestion goes. Also, It seems that I followed posting guidelines which is good to know.
    – mark leeds
    Nov 23, 2021 at 16:37
  • Just wondering: did you try this? did it work for you?
    – NickD
    Nov 30, 2021 at 22:58
  • 1
    Apologies for not explaining what happened as far as your solution. I didn't end up trying your solution because, once I upgraded my ubuntu to 21.10, that problem went away and a new problem appeared. ( see my comment below ). But once I put chen bin's set commands in, those new problems went away. Thanks.
    – mark leeds
    Dec 2, 2021 at 1:04
  • Thanks for letting me know!
    – NickD
    Dec 2, 2021 at 2:11

See https://emacs.stackexchange.com/a/66732/202

The key point is Emacs' python environment is independent.

  • I will definitely read that link but when I upgraded my ubuntu, now I get a new error which is: eldoc error ( error: cannot find executable python. please set 'elpy-rpc-python command' to an existing executable ). This is probably because I've noticed that to run python in my current unbuntu 21.4, I need to type python3 rather than python. But late tonight when I get back, I will read your link and see if that helps. Thanks for your help.
    – mark leeds
    Nov 24, 2021 at 22:47
  • Based on the useful link that you pointed to, I put the following in my dotemacs file but emacs --debug-init sieve.py command shows that it has syntax problems. Would you mind providing the correct syntax ? I don't speak lisp but I'm always on linux so I don't need an if for windows. Thanks. (defcustom elpy-rpc-python-command) (executable-find "python3")
    – mark leeds
    Nov 25, 2021 at 7:31
  • I did find the link below which explained things in more detail but I still couldn't figure out the correct syntax. thanks again. gnu.org/software/emacs/manual/html_node/eintr/defcustom.html
    – mark leeds
    Nov 25, 2021 at 7:49
  • I updated the linked anaswer.
    – chen bin
    Nov 25, 2021 at 8:21
  • after upgrading to ubuntu 21.10 ( which fixed the initial messages that were explained in my initial posting at the top of this thread that NickD responded to ) and then using the setq commands for both elpy-rpc-python command and python-shell-interpreter in order to deal with python3 being the binary, things are now currently working with zero error messages. Thank you very much for your help and I hope that others can benefit from this thread.
    – mark leeds
    Nov 25, 2021 at 18:56

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.