company-jedi icon indicating copy to clipboard operation
company-jedi copied to clipboard

Completion attempt gets wrong-type-argument (epc:manager nil)

Open BigBaaadBob opened this issue 4 years ago • 1 comments

GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)

Using miniconda3 virtual environments

Company and company-jedi installed from Melpa:

  company            20201014.2251 installed 
  company-jedi       20200324.25   installed
  pyvenv             20191202.1039 installed 

Prereqs installed:

$ conda list | grep 'epc\|jedi'
epc                       0.0.5                    pypi_0    pypi
jedi                      0.17.2                   pypi_0    pypi

Config:

;; company
(eval-after-load "company"
  '(add-to-list 'company-backends 'company-jedi))
(add-hook 'after-init-hook 'global-company-mode)
(setq jedi:server-command '("~/.emacs.d/elpa/jedi-core-20191011.1750/jediepcserver.py"))

jediepcserver.py works at that path:

$ ~/.emacs.d/elpa/jedi-core-20191011.1750/jediepcserver.py --help
usage: jediepcserver.py [-h] [--address ADDRESS] [--port PORT]
                        [--port-file PORT_FILE] [--sys-path SYS_PATH]
                        [--sys-path-append SYS_PATH_APPEND]
                        [--virtual-env VIRTUAL_ENV] [--log LOG]
                        [--log-level {CRITICAL,ERROR,WARN,INFO,DEBUG}]
                        [--log-rotate-max-size LOG_ROTATE_MAX_SIZE]
                        [--log-rotate-max-count LOG_ROTATE_MAX_COUNT]
                        [--log-traceback] [--pdb] [--ipdb]

Jedi EPC server.

Completion fails with:

*** jedi-mode is disabled in #<buffer hello.py> ***
Fix the problem and re-enable it.

*** You may need to run "M-x jedi:install-server". ***
This could solve the problem especially if you haven't run the command yet
since Jedi.el installation or update and if the server complains about
Python module imports.

I enabled debug on error and get this traceback:

Debugger entered--Lisp error: (wrong-type-argument epc:manager nil)
  signal(wrong-type-argument (epc:manager nil))
  jedi:epc--start-epc("~/.emacs.d/elpa/jedi-core-20191011.1750/jediepcserver.py" nil)
  jedi:server-pool--start(("~/.emacs.d/elpa/jedi-core-20191011.1750/jediepcserver.py"))
  jedi:start-server()
  jedi:get-epc()
  jedi:call-deferred(complete)
  company-jedi-candidates(#f(compiled-function (candidates) #<bytecode 0x2a33485>))
  company--fetch-candidates(#("impo" 0 4 (fontified t)))
  company-calculate-candidates(#("impo" 0 4 (fontified t)) nil)
  company--begin-new()
  company--perform()
  company-auto-begin()
  company-idle-begin(#<buffer hello.py> #<window 3 on hello.py> 75 5)
  apply(company-idle-begin (#<buffer hello.py> #<window 3 on hello.py> 75 5))
  timer-event-handler([t 24471 6093 761307 nil company-idle-begin (#<buffer hello.py> #<window 3 on hello.py> 75 5) nil 0])

This happens nomatter what I put in jedi:server-args.

Company completion seems to be working fine for elisp. I haven't tried any other backends. I appreciate this isn't a standard config, but it is difficult to have multiple venv setups in a Conda environment.

BigBaaadBob avatar Oct 26 '20 18:10 BigBaaadBob

Here is my output from jedi:show-setup-info that shows things aren't happy.

;; Emacs Lisp version:
(:emacs-version "26.3" :jedi-version "0.2.8" :python-environment-version "0.0.2alpha0")
;; Python version:
nil
;; EPC error:
(:get-epc-error
 (wrong-type-argument epc:manager nil))
;; Command line:
(:virtualenv nil :virtualenv-version nil)
;; Customization:
((jedi:complete-on-dot)
 (jedi:doc-display-buffer . display-buffer)
 (jedi:doc-hook view-mode)
 (jedi:doc-mode . rst-mode)
 (jedi:environment-root)
 (jedi:environment-virtualenv)
 (jedi:get-in-function-call-delay . 1000)
 (jedi:get-in-function-call-timeout . 3000)
 (jedi:goto-definition-config
  (nil nil nil)
  (t nil nil)
  (nil definition nil)
  (t definition nil)
  (nil nil t)
  (t nil t)
  (nil definition t)
  (t definition t))
 (jedi:goto-definition-hook)
 (jedi:goto-definition-marker-ring-length . 16)
 (jedi:imenu-create-index-function . jedi:create-nested-imenu-index)
 (jedi:import-python-el-settings . t)
 (jedi:install-imenu)
 (jedi:install-python-jedi-dev-command "pip" "install" "--upgrade" "git+https://github.com/davidhalter/jedi.git@master#egg=jedi")
 (jedi:key-complete .
                    [C-tab])
 (jedi:key-goto-definition .
                           [67108910])
 (jedi:key-goto-definition-pop-marker .
                                      [67108908])
 (jedi:key-related-names . "r")
 (jedi:key-show-doc . "d")
 (jedi:server-args)
 (jedi:server-command "~/.emacs.d/elpa/jedi-core-20191011.1750/jediepcserver.py")
 (jedi:setup-keys)
 (jedi:tooltip-method pos-tip popup)
 (jedi:use-shortcuts)
 (python-environment-default-root-name . "default")
 (python-environment-directory . "~/.emacs.d/.python-environments")
 (python-environment-virtualenv "virtualenv" "--system-site-packages" "--quiet"))

I've tried to do things like this with no significant improvement:

;;(setq python-environment-virtualenv '("python" "-m" "venv"))
;;(setq python-environment-directory "~/miniconda3/envs")

The actual warning I get is:

Error (jedi): 
================================
Failed to start Jedi EPC server.
================================

*** EPC Error ***
Searching for program

*** EPC Server Output (last 10 lines) ***


*** EPC Server Config ***
Server arguments: ("~/.emacs.d/elpa/jedi-core-20191011.1750/jediepcserver.py")
Actual command: nil ("~/.emacs.d/elpa/jedi-core-20191011.1750/jediepcserver.py" not found in exec-path)
VIRTUAL_ENV envvar: nil

*** jedi-mode is disabled in #<buffer *scratch*> ***
Fix the problem and re-enable it.

*** You may need to run "M-x jedi:install-server". ***
This could solve the problem especially if you haven't run the command yet
since Jedi.el installation or update and if the server complains about
Python module imports.

BigBaaadBob avatar Oct 27 '20 20:10 BigBaaadBob