elpy
elpy copied to clipboard
No module named 'encodings
The Elpy config buffer told me to report here about this problem.
This is the elpy config including the error report.
Elpy Configuration
Emacs.............: 27.1
Elpy..............: Not found (Python), 1.34.0 (Emacs Lisp)
Virtualenv........: None
Interactive Python: python 3.9.0 (c:/Users/Buhtzy/AppData/Local/Programs/Python/Python39/python.exe)
RPC virtualenv....: rpc-venv (c:/Users/Buhtzy/AppData/Roaming/.emacs.d/elpy/rpc-venv)
Python...........: c:/WINDOWS/py.exe nil (c:/WINDOWS/py.exe)
Jedi.............: Not found
Rope.............: Not found
Autopep8.........: Not found
Yapf.............: Not found
Black............: Not found
Syntax checker....: flake8.exe (c:/Program Files (x86)/Python37-32/Scripts/flake8.exe)
Warnings
You have not activated a virtual env. While Elpy supports this, it is
often a good idea to work inside a virtual env. You can use M-x
pyvenv-activate or M-x pyvenv-workon to activate a virtual env.
The Python interpreter could not find the elpy module. Please report
to: https://github.com/jorgenschaefer/elpy/issues/new.
There was an unexpected problem starting the RPC process. Please check
the following output to see if this makes sense to you. To me, it
doesn't.
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00001fbc (most recent call first):
Elpy could not connect to Pypi (or at least not quickly enough) and
check if the python packages were up-to-date. You can still try to
update all of them:
I am using Win 10. Python is installed but I do not understand why (see line 4) elpy does not find it. But Line 6 shows the correct Python interpreter. I am confused.
And about the missing encodings module. There is also a (for me) unknown problem. Here you see the PowerShell output.
py -3 -m pip install encodings
ERROR: Could not find a version that satisfies the requirement encodings
ERROR: No matching distribution found for encodings
This is my init.el.
;; .emacs.d/init.el
;; ===================================
;; MELPA Package Support
;; ===================================
;; Enables basic packaging support
(require 'package)
;; Adds the Melpa archive to the list of available repositories
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
;; Initializes the package infrastructure
(package-initialize)
;; If there are no archived package contents, refresh them
(when (not package-archive-contents)
(package-refresh-contents))
;; Installs packages
;;
;; myPackages contains a list of package names
(defvar myPackages
'(better-defaults ;; Set up some better Emacs defaults
elpy ;; Python Support
material-theme ;; Theme
evil
)
)
;; Scans the list in myPackages
;; If the package listed is not already installed, install it
(mapc #'(lambda (package)
(unless (package-installed-p package)
(package-install package)))
myPackages)
;; ===================================
;; Basic Customization
;; ===================================
(setq inhibit-startup-message t) ;; Hide the startup message
(load-theme 'material t) ;; Load material theme
(global-linum-mode t) ;; Enable line numbers globally
(setq make-backup-files nil)
;; Recent files
(recentf-mode 1)
(setf recentf-max-menu-items 20)
(setf recentf-max-saved-items 20)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)
(run-at-time nil (* 5 60) 'recentf-save-list)
;; ===================
;; Evil mode
;; ===================
(require 'evil)
(evil-mode t)
;; =========================
;; Elpy/Python Environment
;; =========================
(elpy-enable)
;;(setq python-shell-interpreter "py"
;; python-shell-interpreter-args "-3 -i")
(cd "C:/Users/Buhtzy/")
;; User-Defined init.el ends here
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:family "Fira Mono" :foundry "outline" :slant normal :weight normal :height 120 :width normal)))))
it looks like elpy is trying to use c:/WINDOWS/py.exe as a python interpreter.
Two things you can try:
- reinstall the rpc with
elpy-rpc-reinstall-virtualenv - if it does not work, try using
(setq elpy-rpc-virtualenv-path 'current)
It may help !
What is "RPC"? Remote procedure call? And you write about virtualenv. I do not use a virtual environment. This is explicite deactivated in elpy.