Open falcomomo opened 5 years ago
Hi @kevindragon - I downloaded the updated code after your fix, but unfortunately it had no effect
Can I ask what is the result of (executable-find elpy-rpc-python-command) on your machine?
I get "C:/PF/Anaconda3/envs/py36/pythonw.exe"
Hi,
The python interactive interpreter (C:/Program Files/Anaconda3/envs/py36/python.exe) is not installed on the current virtualenv (c:/PF/Anaconda3/envs/py36/).
It is usually a good idea to use binary names for python-shell-interpreter
instead of full paths.
Specifically if your are using virtualenvs.
Would it work for you with ?
(setq python-shell-interpreter "python.exe")
Also, the Elpy virtualenv taht is dedicated to the RPC seems to be not working.
Is c:/Users/<user>/AppData/Roaming/.emacs.d/elpy/rpc-venv
a viable environment for you ?
Thanks, I tidied up the shell interpreter path, but still no effect.
This does look like a viable environment, yes... However, if I run the python executable within that path rpc-venv/Scripts/pythonw.exe and run import jedi, I cannot find the module.
Ok, I tried a few more things prompted by the helpful questions - I removed the activation of a virtual env (my Anaconda env).
After doing this, the goto definition works, but my config file looks a lot different...
Now I have the following:
Elpy Configuration
Emacs.............: 26.1
Elpy..............: 1.31.0
Virtualenv........: None
Interactive Python: python.exe 3.7.0 (c:/PF/Anaconda3/python.exe)
RPC virtualenv....: rpc-venv (c:/Users/<user>/AppData/Roaming/.emacs.d/elpy/rpc-venv)
Python...........: c:/PF/Anaconda3/pythonw.exe 3.7.0 (c:/PF/Anaconda3/pythonw.exe)
Jedi.............: 0.12.1
Rope.............: 0.11.0
Autopep8.........: Not found
Yapf.............: Not found
Black............: Not found
Syntax checker....: Not found (flake8)
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 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]
And my config file is:
(require 'pyvenv)
;; (pyvenv-activate "C:/PF/Anaconda3/envs/py36")
(require 'elpy)
(add-to-list 'load-path "C:/Users/<user>/AppData/Roaming/.emacs.d/site-lisp/elpy-master")
(load "elpy")
(load "elpy-rpc")
(load "elpy-shell")
(load "elpy-profile")
(load "elpy-refactor")
(load "elpy-django")
(elpy-enable)
(require 'python-mode)
(autoload 'python-mode "python-mode" "Python Mode." t)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))
(require 'blacken)
(setq blacken-skip-string-normalization t)
(setq blacken-line-length 79)
(setq fill-column 79)
(add-hook 'python-mode-hook 'blacken-mode)
(when (require 'flycheck nil t)
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-mode))
(define-key global-map (kbd "C-M-g") 'elpy-goto-definition)
(setq python-shell-interpreter "python.exe")
(setq elpy-eldoc-show-current-function nil)
Is there a good reason to use pythonw.exe
instead of python.exe
?
If not, you could try
(setq elpy-rpc-python-command "python.exe")
(I assume it is set to pythonw.exe
at the moment ?), c:/Users/<user>/AppData/Roaming/.emacs.d/elpy/rpc-venv
M-x elpy-rpc-restart
.There is no reason to use pythonw.exe
- I think it was default populated by elpy.
Unfortunately changing this, and following the rest of the suggestions also had no effect.
I was able to get everything working by making my config:
(setq python-shell-interpreter "C:/PF/Anaconda3/envs/py36/python.exe")
(setq elpy-rpc-python-command "C:/PF/Anaconda3/envs/py36/pythonw.exe")
(setq elpy-syntax-check-command "C:/PF/Anaconda3/envs/py36/Scripts/flake8.exe")
(setq flycheck-python-flake8-executable "C:/PF/Anaconda3/envs/py36/Scripts/flake8.exe")
(add-to-list 'py-shell-extra-pythonpaths "c:/Users/<user>/dev/<library_name>/src/python" "c:/Users/<user>/dev/<library_name>/src/scripts")
Although it works now as intended, I'm a little confused about what is actually different to just using the virtual env solution from elpy.
Could you post your elpy-config
now that it is working ?
I am curious to see what actually changed from your first post.
ps: The py-shell-extra-pythonpaths
variable belongs to the python-mode.el
package.
As Elpy and python-mode.el offers the same kind of functionalities (and are probably not compatible), I would choose one and delete the other one.
Summary
Hi, I was running elpy with versión 20190130.2109 without any issues relating to this - I could view definitions originating from other files and within same files. Since updating (I noticed there is a new rpc-venv folder on disk now) it doesn't work. I cannot even view definitions within same file.
I have tried to verify jedi works, using some hints given to another user here (Chinese) and my jedi seems to work - at least with the python exe I intend to use.
Steps to reproduce
elpy-goto-definition
My configuration
OS
Windows 10
Result of
(elpy-config)
Elpy configuration in my init.el