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

I only get it in specific cases and I am not sure what is causing it. I am reading some data like this,

# !/usr/bin/env python3

import pickle
from variables import objects_address
photos = pickle.load(open(objects_address + '2019-10-19 21:18:23.dat', 'rb'))

There is more in this file but in order to narrow the problem I commented all of it. But, the warning persists. After this I do some manipulations to the array of photo objects which photos is and ask for a Y/n to save the photos with manipulations using input(). The program does not halt at this point if I get the warning and it just continues execution. I made this test file,

# !/usr/bin/env python3

import pickle
# from geocoder import ip

n = [1,2,3]
pickle.dump(n, open('TEST.TEST', 'wb'))
x = pickle.load(open('TEST.TEST', 'rb'))

name = input('What is your name? ')
print('That\'s a nice name, ' + name + '!')

This file runs and acts perfectly fine; takes input and all that. Although, I tried putting from geocoder import ip in this file and that reproduced the warning. If you add this import to my test file (or even a file with just this one line), we get the same warning.

Here is the output of the test file (with the import that causes the warning):

Python 3.6.8 (default, Oct  7 2019, 12:59:55) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> [1, 2, 3]
What is your name? That's a nice name, import codecs, os;__pyfile = codecs.open('''/tmp/py8974PaE''', encoding='''utf-8''');__code = __pyfile.read().encode('''utf-8''');__pyfile.close();os.remove('''/tmp/py8974PaE''');exec(compile(__code, '''/tmp/py8974PaE''', 'exec'));!

Here is output without the import that causes the warning (I omitted the version info),

What is your name? Tom
That's a nice name, Tom!
>>> python.el: native completion setup loaded

Note that in my original file where I read data, I am not importing this geocoder. It was in a neighbouring file where I made the test file and I ran it randomly and realised that it also causes the warning.

I have tried different solutions which people suggested about this warning but non of them worked. I am running GNU Emacs 25.2.2 on Ubuntu 18.04.3 LTS

This is my use-package configurations for elpy in my .emacs:

;; elpy
(use-package elpy 
  :ensure t 
  :defer t 
  (setq elpy-rpc-python-command "python3")
  (defun my-python-shell-run ()
    "Run python and pop-up its shell.
     Kill process to solve the reload modules problem."
    (when (get-buffer-process "*Python*")
      (set-process-query-on-exit-flag (get-buffer-process "*Python*") nil) 
      (kill-process (get-buffer-process "*Python*"))
      ;; If you want to clean the buffer too.
      (kill-buffer "*Python*")
      ;; Not so fast!
      (sleep-for 0.5)) 
    (run-python (python-shell-parse-command) nil nil) 
    ;; Pop new window only if shell isnt visible in any frame.
    (unless (get-buffer-window "*Python*" t) 
  :hook (elpy-mode . (lambda () 
               (highlight-indentation-mode -1) 
               (linum-mode t))) 
  :bind (:map elpy-mode-map
          ("C-e" . 'elpy-format-code) 
          ("C-w" . 'elpy-pdb-debug-buffer)
          ("M-w" . 'elpy-pdb-toggle-breakpoint-at-point)
          ("C-l C-p" . 'elpy-pdb-break-at-point)
          ("C-c C-c" . 'my-python-shell-run)
          ("C-h f" .'python-eldoc-at-point)
           . (lambda ()
                   (process-buffer (elpy-shell-get-or-create-process))

1 Answer 1


AFAIU that warning only realizes if you call TAB at the end of a symbol, which will try completion.

It's just a warning. If Python3's module pyreadline is not installed. Emacs' own completion will not work in Python3. This warning would not happen if native completion for Python3 is disabled as a member of python-shell-completion-native-disabled-interpreters.

Either installing pyreadline or customizing python-shell-completion-native-enable to nil should switch the warning off. If not, please consider filing a bug-report.

Commentary section of python.el explains the details:

Shell completion: hitting tab will try to complete the current word. The two built-in mechanisms depend on Python's readline module: the "native" completion is tried first and is activated when python-shell-completion-native-enable' is non-nil, the currentpython-shell-interpreter' is not a member of the python-shell-completion-native-disabled-interpreters' variable and python-shell-completion-native-setup' succeeds; the "fallback" or "legacy" mechanism works by executing Python code in the background and enables auto-completion for shells that do not support receiving escape sequences (with some limitations, i.e. completion in blocks does not work). The code executed for the "fallback" completion can be found in python-shell-completion-setup-code' and python-shell-completion-string-code' variables. Their default values enable completion for both CPython and IPython, and probably any readline based shell (it's known to work with PyPy). If your Python installation lacks readline (like CPython for Windows), installing pyreadline (URL `http://ipython.org/pyreadline.html') should suffice. To troubleshoot why you are not getting any completions, you can try the following in your Python shell:

import readline, rlcompleter

If you see an error, then you need to either install pyreadline or setup custom code that avoids that dependency.

  • import readline, rlcompleter does not return an error. However, (setq python-shell-completion-native-enable nil) fixed the program not halting to take input and also caused the warning to disappear. But even when I was getting the warning, afterwards my completion worked fine. The warning popped when I ran the script not when I hit TAB. Either way, I am still confused to why does python-shell-completion-native-enable fail and we have to resort to the fallback? Why does my python-shell-interpreter not support readline?
    – scribe
    Oct 27, 2019 at 19:49
  • Extended the answer accordingly. It seems to exist some redundancy in Emacs source BTW. Oct 27, 2019 at 20:22

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.