2

I have trouble to get elpy working on Windows 10 with Emacs 27 (Downloaded from http://ftp.gnu.org/gnu/emacs/windows/emacs-27/emacs-27.2-x86_64-installer.exe).

When I do M-x elpy-config I got the error message Neither easy_install nor pip found. That makes it impossible for me to check out the great elpy config buffer that would show me what elpy is missing.

Python 3.9.10 is installed. I am able to invoke it via py -3 and python on the windows command prompt. Also pip and py -3 -m pip are working well.

Values of the Windows PATH:

echo %PATH%
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\user\AppData\Local\Programs\Python\Python39\Scripts\;C:\Users\user\AppData\Local\Programs\Python\Python39\;C:\Users\user\AppData\Local\Microsoft\WindowsApps;

Values of exec-path:

exec-path is a variable defined in C source code.

Value
("c:/Windows/system32" "C:/Windows" "C:/Windows/System32/Wbem" "C:/Windows/System32/WindowsPowerShell/v1.0/" "C:/Windows/System32/OpenSSH/" "C:/Users/user/AppData/Local/Programs/Python/Python39/Scripts/" "C:/Users/user/AppData/Local/Programs/Python/Python39/" "C:/Users/user/AppData/Local/Microsoft/WindowsApps" "." "c:/Program Files/Emacs/x86_64/libexec/emacs/27.2/x86_64-w64-mingw32")

Original Value
("c:/Windows/system32" "c:/Windows" "c:/Windows/System32/Wbem" "c:/Windows/System32/WindowsPowerShell/v1.0" "c:/Windows/System32/OpenSSH" "c:/Users/user/AppData/Local/Programs/Python/Python39/Scripts" "c:/Users/user/AppData/Local/Programs/Python/Python39" "c:/Users/user/AppData/Local/Microsoft/WindowsApps" "." "c:/Program Files/Emacs/x86_64/libexec/emacs/27.2/x86_64-w64-mingw32")

btw: I do not know why x86_64-w64-mingw32 is part of the exec-path. This does not exist on my system; MinGW is not installed.

There is also an open issue about that problem.

1
  • 1
    Where did you get the emacs from - the link please.
    – mmmmmm
    Feb 9, 2022 at 12:32

1 Answer 1

1

Since you use Windows, check the python installation path with the command where python in windows command prompt. Then use the obtained value in the following snippet:

(setenv "PATH" (concat "/Users/yourname/.pyenv/shims/python:"
                       (getenv "PATH")))
(add-to-list 'exec-path "/Users/yourname/.pyenv/shims/python")

(The path shown is for my system, replace it with your value).

This is caused by the emacs having two path, as shown, which must be in sync to work. Some people disagree with that, in *nix systems usually the package exec-path-from-shell is used, but that do not work in Windows.

2
  • I will test that but I assume this would not help because the value from where python is still set to PATH and exec-path as you can see in my question.
    – buhtz
    Feb 11, 2022 at 12:58
  • I rejected elpy and now use Emacs own python mode and eglot as an lsp solution.
    – buhtz
    Mar 22, 2022 at 8:08

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.