Whenever I try to use elpy, or even just fontlock (with elpy disabled) in a python file, I get the error that rx-let is void.

This is what I got from --debug-init:

Debugger entered--Lisp error: (void-function rx-let)
  (rx-let ((block-start (seq symbol-start (or "def" "class" "if" "elif" "else" "try" "except" "finally" "for" "while" "with" (and "async" (+ space) (or "de$
  (python-rx line-start (* space) defun (+ space) (group symbol-name))
  (defvar python-nav-beginning-of-defun-regexp (python-rx line-start (* space) defun (+ space) (group symbol-name)) "Regexp matching class or function defi$
  eval-buffer(#<buffer  *load*-951749> nil "/home/ben/.emacs.d/elpa/python-0.27/python.el" nil t)  ; Reading at buffer position 60382

I am using the Ubuntu 26.3 Build. This is just driving me nuts. I tried searching for this error, but I didn't get any results. Requesting for help.

  • 1
    Try adding (require 'rx) to your init file. – NickD Nov 23 '20 at 16:11
  • This question is likely a duplicate. Hope someone has the time to search for it... – Drew Nov 23 '20 at 16:19
  • 4
    rx-let is new in Emacs 27; so either you are using a newer version of python.el in an older Emacs version, or one of the packages you're using is. – Basil Nov 23 '20 at 19:23
  • 1
    @NickD I did try to search for other questions. I spent a good 3hrs doing so. Please don't call me a poster. I suppose even my search fu is defective. – Benjamin Philip Nov 24 '20 at 2:36
  • 1
    @jjmerelo Each version of Emacs comes with its own version of python.el built-in. You can inspect the file with emacs -Q followed by M-x find-library RET python RET. To install other versions of python.el (which I can't recommend in general), there's the GNU ELPA package; see elpa.gnu.org/packages/python.html. – Basil Feb 10 at 11:55

Solution for me: M-x package-delete then python-0.27.1.

Ubuntu 20.10, emacs 26.3 (from distro). I had installed python-0.27.1 (via Options > Manage Emacs Packages) after naively assuming that anything offered for installation was workable. Oops.


From @Basil's suggestion, that my python.el was a newer version, I decided to re-install my emacs.

The following worked:

sudo apt remove emacs-gtk
sudo apt install emacs-gtk

I don't know why, but I think even though python.el was built-in, the wrong version was installed. Re-installing has fixed that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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