I deleted my old Python installation, so the only Python installation remaining is the one inside Anaconda. when I start Spyder I get:

Python 3.7.4 (default, Aug  9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 7.8.0 -- An enhanced Interactive Python.

Within a shell:

d:\docs\ML\scox>which ipython
which ipython

Inside my C:/emacs there is only python.el and no python-mode.el.

I made the following changes in python.el:

(setq python-shell-interpreter "ipython"
      python-shell-interpreter-args "-i")

(setq python-shell-virtualenv-root "C:/anaconda3/Scripts/")

Still, it does not start IPython (it does not start anything). Here is the output from the Messages buffer:

Source file ‘c:/emacs/emacs26/share/emacs/26.1/lisp/progmodes/python.el’ newer than byte-compiled file
apply: Searching for program: No such file or directory, python

What do I need to do to start the same process as the one, above, in Spyder?

  • Try giving the explicit path C:\anaconda3\Scripts\ipython.EXE for your python-shell-interpreter variable Commented Jul 31, 2020 at 15:25
  • the full path does not change anything. the error message reveals that C-c C-p is still looking for python not ipython.
    – Stephen
    Commented Aug 1, 2020 at 18:06
  • This is probably because it is looking for a python.exe file in your python-shell-virtualenv-root. You can try 1. not setting the python-shell-virtualenv-root at all or 2. setting it to C:/anaconda3/ while giving the full path to the python-shell-interpreter as I said earlier. I personally use the packages pyvenv to manage virtualenvs (and elpy) to avoid this kind of hassle. I hope this helps. Commented Aug 3, 2020 at 16:23

1 Answer 1


Some observations for your problem:

a) FIY: There is only a python mode, and should be as it is because someone else wrote a python-mode package here:https://gitlab.com/python-mode-devs/python-mode, which is a totally different thing.

b) You should not do modifications in package's files - at the first update you will loose them. Instead, use an init.el file, where you make all needed configurations. But, since you already opened/modified the file python.el, read the comments at the beginning, since there you will find out answer(s) to your question (excerpt from file):

(setq python-shell-interpreter "C:/Python27/python.exe"
      "-i C:/Python27/Scripts/ipython-script.py")

Take the above as example and modify paths according to your windows system.

c) You may still have trouble with ipython due to readline and rlcompleter - I do not know the status of that in Windows - but for unix/linux many users set python as inferior shell interpreter instead ipython.

d) To start an inferior Python process use the command M-x run-python or enable the menu and see what is set and use from there, at least until you get more experienced.

e) In Emacs there are an environment path and an execution path - both should be in sync to work correctly - a small trick to do that is as below:

(setenv "PATH" (concat "your-path-to/anaconda3/bin:"
                       (getenv "PATH")))
(add-to-list 'exec-path "your-path-to/anaconda3/bin")

Use this at the beginning of python configuration in your init.el file.

f) Try to update your iPpython, mine is version 7.13.0

EDIT g) It is useful to use use-package package to configure everything in your Emacs. Example for Python:

(use-package python
  :ensure nil
  ("\\.py\\'" . python-mode)

  (setq-default indent-tabs-mode nil)

  ((python-mode . smartparens-mode)
   (python-mode . company-mode)
   (python-mode . flycheck-mode)
   (inferior-python-mode . smartparens-mode))

  (setq python-indent-offset 4
        python-indent-guess-indent-offset-verbose nil
        python-shell-interpreter "python"
        ;; python-shell-interpreter-args "-i --simple-prompt"

Note: The function python-shell-calculate... is not accessed directly by the user.

  • where do I place the init.el so it runs automatically? or do I load it from my .emacs file?
    – Stephen
    Commented Aug 5, 2020 at 12:55
  • Create a .emacs.d folder instead of .emacs and place there your init.el file..
    – Ian
    Commented Aug 5, 2020 at 13:47
  • still does not work and the error message is the same. do you know how to send the value of python-shell-calculate-command to the messages buffer? I will put this at the end of (defun run-python)
    – Stephen
    Commented Aug 6, 2020 at 12:45
  • I do not have such command on my system. BTW, do you already use elpy?
    – Ian
    Commented Aug 6, 2020 at 13:51
  • python-shell-calculate-command is set in python.el and it should return the path to the executable being called by C-c C-p. my question is how to send a string to the messages buffer.I will look at elpy and unset the virtualenv variable.
    – Stephen
    Commented Aug 9, 2020 at 17:48

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.