Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Failed to start Jedi EPC server" with otherwise valid configuration #292

Open
sbroberg opened this issue Sep 20, 2017 · 2 comments
Open

Comments

@sbroberg
Copy link

sbroberg commented Sep 20, 2017

I am unable to run the jedi server on a machine that appears to be identical, configuration wise, to another, although I'm sure the problem lies in my environment outside emacs.

I have two Mac machines, one running 10.12, the other 10.13. Both machines have an identical init.el, which is:

;;; package --- Summary
;;; Commentary:
;;; Code:

(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(load custom-file)

;; Melpa
(require 'package)
(add-to-list 'package-archives
             '("melpa-stable" . "http://stable.melpa.org/packages/") t)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/") t)

(package-initialize)
;; END Melpa

(defconst my-installed-packages
  '(
    jedi                 ;; python environment
    py-autopep8          ;; for pep8 enforcement
    ))

(defun install-packages ()
  "Install all required packages."
  (interactive)
  (unless package-archive-contents
    (package-refresh-contents))
  (dolist (package my-installed-packages)
    (unless (package-installed-p package)
      (package-install package))))

(install-packages)

(require 'python)
(require 'jedi)

(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)

(define-key python-mode-map (kbd "M-.")
  (function jedi:goto-definition))

I also have a .dir-locals.el file in the root of my github project which sets the root of my project when I'm visiting files:

((nil . ((eval . (setq cmake-ide-build-dir (concat (projectile-project-root) "build_debug"))
               )))
 (python-mode . ((eval . (setq jedi:server-args (list "--sys-path" (concat (projectile-project-root) "automation")))
         ))))

On 10.12, I am successfully able to open .py files in my github project and have all features working. On 10.13, the same files opened in the same directory result in *Warnings* displaying:

Error (jedi): Failed to start Jedi EPC server.
*** 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.

*Messages* is displaying:

deferred error : (file-error "Failed connect" "Connection refused")

There is also an epc con 3 buffer that is empty.

I believe that jedi & epc are installed correctly, as I can run the the command specified by my server-command variable without error:

stephens-mbp:.emacs.d stephenbroberg$ python /Users/stephenbroberg/.emacs.d/elpa/jedi-core-20170121.610/jediepcserver.py
49690

Running M-x jedi:install-server completes successfully, but it doesn't result in the jedi mode working successfully (I get import-errors for python modules that exist within my project). *Messages* produces this output after running M-x jedi:install-server:

Making virtualenv at /Users/stephenbroberg/.emacs.d/.python-environments/default...
Making virtualenv at /Users/stephenbroberg/.emacs.d/.python-environments/default...Done
Running: pip install --upgrade /Users/stephenbroberg/.emacs.d/elpa/jedi-core-20170121.610/...Done
@dhui
Copy link

dhui commented Sep 30, 2017

I hit a similar issue after upgrading from macOS Sierra to High Sierra.
I also have python2 (latest version) installed via homebrew.

I resolved my issue by running:

  1. rm -r ~/.emacs.d/.python-environments/default in Terminal
    • You may want to use mv instead
  2. virtualenv -p python2 ~/.emacs.d/.python-environments/default in Terminal
  3. M-x jedi:install-server in emacs

YMMV

@immerrr immerrr added the macos label Nov 7, 2018
@immerrr
Copy link
Collaborator

immerrr commented Nov 12, 2018

Please, try out the current master to see if the issue persists.

If it does, I'm going to need your help troubleshooting this issue, because I don't have easy access to Mac OS X environments. I have improved the error message that's shown when the server cannot start to facilitate investigating the underlying problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants