1

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.

Drew
  • 75,699
  • 9
  • 109
  • 225
  • 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
  • I don't know if my search fu is defective, but trying to find duplicate questions on the Emacs SE (even when I *KNOW* that one exists) has been a frustrating experience. Is there a tutorial on "Useful techniques for searching SE sites"? That would be useful also for posters who might not bother to search for an existing question. – NickD Nov 23 '20 at 18:05
  • 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
  • @Basil Ok thank you. I installed all the packages using emacs's package manager. And I installed emacs with `sudo apt install emacs-gtk`. I wonder what went wrong. – Benjamin Philip Nov 24 '20 at 02:31
  • 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 02:36
  • @BenjaminPhilip I was bemoaning the poor state of search on SE - I certainly was not impugning or accusing you of anything. It *is* a common question, but the reason it is a common question is that it is difficult to find existing answers (and there can be various answers to this problem). – NickD Nov 24 '20 at 03:25
  • @NickD Very sorry about accusing you of anything. And I certainly agree with you about finding existing questions on SE. – Benjamin Philip Nov 24 '20 at 03:35
  • @Basil is there a way to install a version that works with emacs 26? – jjmerelo Feb 10 '21 at 11:33
  • 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 https://elpa.gnu.org/packages/python.html. – Basil Feb 10 '21 at 11:55

2 Answers2

1

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.

Reece
  • 126
  • 2
0

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.