On Emacs 25.2 and Python 3.5 on an Centos-like Oracle Linux I have the issue that invoking a python shell gives me no completion. To reproduce, start

$ emacs -Q --eval '(setq python-shell-interpreter "python3")'

then execute

M-x run-python

This produces the warning

Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support readline, yet ‘python-shell-completion-native’ was t and "python3" is not part of the ‘python-shell-completion-native-disabled-interpreters’ list.  Native completions have been disabled locally.

It is the same problem as Your ‘python-shell-interpreter’ doesn’t seem to support readline, but:

1) I am already on Emacs version 25.2, so the fixfrom one answer does not help (because 25.2 contains the proposed fix).

2) I am on bash 4.1 and have no ~/.inputrc file, so the fix from the other answer doesn't help either.

How can I fix this?


On my MacOS machine the initialisation works correctly. However on MacOS I use Emacs 25.3. Therefore I installed 25.3 (from source ) on the Oracle Linux system, too - the Python completion still fails, because of same above mentioned issue!

  • What do you get from import readline; print (readline.__doc__) at a python3 shell? Also try the tests I posted here and here.
    – npostavs
    Feb 16, 2018 at 11:59
  • @npostavs I get an ImportError. On Centos (not Windows)! Appears as rather strange to me...
    – halloleo
    Feb 16, 2018 at 13:00
  • Huh. That means your python lacks the readline library for some reason. AFAIK, since it's listed at docs.python.org/3/library/readline.html, it should come installed by default...
    – npostavs
    Feb 16, 2018 at 13:52
  • A web search turns up pyenv/pyenv#111: Build Failure on Centos 6.5: ImportError: No module named readline, although the resolution doesn't sound widely applicable.
    – npostavs
    Feb 16, 2018 at 13:59
  • @npostavs I have upgraded to Emacs 25.3 - but have still the same issue on Linux. :-( (See my update in the question.)
    – halloleo
    Feb 19, 2018 at 5:34

1 Answer 1


The native completion mechanism depends on the gnureadline python module. You can check if it's present by executing

import readline

at a python shell. The message

ImportError: No module named readline

indicates it's missing. It can be installed with pip install gnureadline. When it's correctly installed, the above code should print:

Importing this module enables command line editing using GNU readline.

The readline module might be missing on Oracle Linux for Python versions which are installed from source.

  • 2
    I'm getting the message saying readline is correctly installed, but still getting the problem in the OP. Using Mac OS High sierra, homebrew cask installed gui emacs 25.3.1, using ipython3 as my emacs python shell
    – xdavidliu
    Mar 15, 2018 at 21:15
  • @xdavidliu macOS and ipython may both add their own complications, I suggest opening a separate question.
    – npostavs
    Mar 16, 2018 at 1:29

Your Answer

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

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