Open arqeco opened 4 years ago
Elpy is trying to build a virtualenv to install the dependencies it needs.
Apparently it fails to write a file in the folder named c:\Users\Márcio\AppData\Roaming\.emacs.d\elpy\rpc-venv
Does this folder exist on your installation ?
If it does, is there a file named pyvenv.cfg
already there ?
After removing all other packages except elpy from myPackages list in init.el, removing all folders from .emacs.d and starting emacs again, the error changes to this when opening an .py file
Output from Backend
There was some unexpected output from the Elpy backend. This is usually not a problem and should usually not be reported as a bug with Elpy. You can safely hide this buffer and ignore it. You can also see the output below in case there is an actual problem.
Output c:\Users\Márcio\AppData\Roaming.emacs.d\elpy\rpc-venv\Scripts\python.exe: Error while finding module specification for 'elpy.main' (ModuleNotFoundError: No module named 'elpy')
Please notice that my user name have an accent. It's Márcio. But the above output shows c:\Users\Márcio.
Now, at least I can use M-X elpy-config. But, despite what is written below, pip is installed on RPC virtualenv.
Elpy Configuration
Emacs.............: 26.3
Elpy..............: Not found (Python), 1.33.0 (Emacs Lisp)
Virtualenv........: venv (d:/teste-emacs/venv/)
Interactive Python: python 3.7.6 (d:/teste-emacs/venv/Scripts/python.exe)
RPC virtualenv....: rpc-venv (c:/Users/Márcio/AppData/Roaming/.emacs.d/elpy/rpc-venv)
Python...........: c:/WINDOWS/py.exe 3.7.6 (c:/WINDOWS/py.exe)
Jedi.............: Not found (0.16.0 available)
Rope.............: Not found (0.16.0 available)
Autopep8.........: Not found (1.5 available)
Yapf.............: Not found (0.29.0 available)
Black............: Not found (19.10b0 available)
Syntax checker....: Not found (flake8)
Warnings
The Python interpreter could not find the elpy module. Please report
to: https://github.com/jorgenschaefer/elpy/issues/new.
Pip doesn't seem to be installed in the dedicated virtualenv created
by Elpy (c:/Users/Márcio/AppData/Roaming/.emacs.d/elpy/rpc-venv). This
may prevent some features from working properly (completion,
documentation, reformatting, ...). You can try reinstalling the
virtualenv. If the problem persists, please report on Elpy's github
page.
[Reinstall RPC virtualenv]
The jedi package is not available. Completion and code navigation will
not work.
[Install jedi]
The autopep8 package is not available. Commands using this will not
work.
[Install autopep8]
The yapf package is not available. Commands using this will not work.
[Install yapf]
The black package is not available. Commands using this will not work.
[Install black]
The configured syntax checker could not be found. Elpy uses this
program to provide syntax checks of your programs, so you might want
to install one. Elpy by default uses flake8.
[Install flake8]
galaunay,
Yes this file exists.
(rpc-venv) C:\Users\Márcio\AppData\Roaming\.emacs.d\elpy\rpc-venv>type pyvenv.cfg
home = C:\Python37
include-system-site-packages = false
version = 3.7.6
Ok, so that's another issue. Probably related to #1757.
In #1757, the faulty function seemed to be elpy-rpc--environment
.
If you run the following snippets, it should display some lines in your *Messages*
buffer:
(defun elpy-rpc--environment ()
"Return a `process-environment' for the RPC process.
This includes `elpy-rpc-pythonpath' in the PYTHONPATH, if set."
(message "\n\n=== DEBUG 'elpy-rpc--environment ===\n")
(message "elpy-rpc-pythonpath: %s" elpy-rpc-pythonpath)
(message "elpy-rpc-pythonpath-fromelpy: %s" (file-name-directory (locate-library "elpy")))
(message "__init__.py: %s" (expand-file-name "elpy/__init__.py"
elpy-rpc-pythonpath))
(message "__init__.py exists ?: %s" (file-exists-p (expand-file-name
"elpy/__init__.py"
elpy-rpc-pythonpath)))
(if (or (not elpy-rpc-pythonpath)
(not (file-exists-p (expand-file-name "elpy/__init__.py"
elpy-rpc-pythonpath))))
process-environment
(let* ((old-pythonpath (getenv "PYTHONPATH"))
(new-pythonpath (if old-pythonpath
(concat elpy-rpc-pythonpath
path-separator
old-pythonpath)
elpy-rpc-pythonpath)))
(message "old-pythonpath: %s" old-pythonpath)
(message "new-pythonpath: %s" new-pythonpath)
(cons (concat "PYTHONPATH=" new-pythonpath)
(append process-environment
(when (and (string-equal system-type "windows-nt")
(>= (string-match-p
(regexp-quote "utf-8")
(format "%s" buffer-file-coding-system))) 0)
(list
"PYTHONIOENCODING=utf-8"
"PYTHONLEGACYWINDOWSSTDIO=1")))))))
(message "%s" (elpy-rpc--environment))
It may help to understand what is happening wrong.
Hello,
I am having this error opening a .py file or using M-X elpy-config:
Windows 10 Home. Version 1903.
GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)
elpy is installed with this init.el: