问题
I have not used emacs for python coding for the last two weeks and by then it was all perfect, my set up worked perfectly, including jedi.
Two days ago I installed virtualenvwrapper
in python (pip install virtualenvwrapper
) and this is all that has changed from two weeks until today in my python installation. Nothing has changed in my emacs installation/set-up at all, absolutely nothing. Today, for the 1st time in two weeks I was going to start coding in python and as I typed emacs test.py
in my terminal I obtained the following error messages in the emacs
window:
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.
deferred error : (error Server may raise an error : Traceback (most recent call last):
File "/Users/javier/.emacs.d/.python-environments/default/bin/jediepcserver", line 5, in <module>
from pkg_resources import load_entry_point
File "/Users/javier/.emacs.d/.python-environments/default/lib/python2.7/site-packages/pkg_resources/__init__.py", line 21, in <module>
import io
File "//anaconda/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/Users/javier/.emacs.d/.python-environments/default/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyErr_ReplaceException
Referenced from: /Users/javier/.emacs.d/.python-environments/default/lib/python2.7/lib-dynload/_io.so
Expected in: dynamic lookup
This is how I installed jedi
a year ago:
1- I first followed the instructions here jedi installation. By the way, epc, argparse, jedi
and virtualenv
are already installed in python, of course.
2- The I read somewhere (I can't remember where) that the the jedi package at melpa is not updated. This sounded strange to me, but I decided to directly download jedi
and also python-environment
from github at: jedi-github and python-environment-github. I placed them at ~/.emacs.d/emacs-jedi/
and ~/.emacs.d/emacs-python-environment/
3- then set up jedi
by doing:
;;Standard Jedi.el setting (read readme-jedi at .emacs.d/)
(add-to-list 'load-path "~/.emacs.d/emacs-jedi/")
(add-to-list 'load-path "~/.emacs.d/emacs-python-environment/")
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)
4- I run on emacs: M-x jedi:install-server
And done!, and this has worked for me during a year until today!.
Of course, as a 1st attempt to solve this I did exactly what the error message suggested and run (again) M-x jedi:install-server
. Then I obtained the following error:
Running: pip install --upgrade /Users/javier/.emacs.d/emacs-jedi/...Done
deferred error : (error Process [/Users/javier/.emacs.d/.python-environments/default/bin/pip] exited abnormally : Traceback (most recent call last):
File "/Users/javier/.emacs.d/.python-environments/default/bin/pip", line 7, in <module>
from pip import main
File "/Users/javier/.emacs.d/.python-environments/default/lib/python2.7/site-packages/pip/__init__.py", line 13, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/Users/javier/.emacs.d/.python-environments/default/lib/python2.7/site-packages/pip/utils/__init__.py", line 14, in <module>
import zipfile
File "//anaconda/lib/python2.7/zipfile.py", line 6, in <module>
import io
File "//anaconda/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/Users/javier/.emacs.d/.python-environments/default/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyErr_ReplaceException
Referenced from: /Users/javier/.emacs.d/.python-environments/default/lib/python2.7/lib-dynload/_io.so
Expected in: dynamic lookup
After this, and some other attempts, I decided to re-install everything, just using melpa. (i.e. following jedi-installation). Then I run M-x jedi:install-server
and got a very similar error message to the one described before:
Making completion list...
Running: pip install --upgrade /Users/javier/.emacs.d/elpa/jedi-core-0.2.5/...Done
deferred error : (error Process [/Users/javier/.emacs.d/.python-environments/default/bin/pip] exited abnormally : Traceback (most recent call last):
File "/Users/javier/.emacs.d/.python-environments/default/bin/pip", line 7, in <module>
from pip import main
File "/Users/javier/.emacs.d/.python-environments/default/lib/python2.7/site-packages/pip/__init__.py", line 13, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/Users/javier/.emacs.d/.python-environments/default/lib/python2.7/site-packages/pip/utils/__init__.py", line 14, in <module>
import zipfile
File "//anaconda/lib/python2.7/zipfile.py", line 6, in <module>
import io
File "//anaconda/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/Users/javier/.emacs.d/.python-environments/default/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyErr_ReplaceException
Referenced from: /Users/javier/.emacs.d/.python-environments/default/lib/python2.7/lib-dynload/_io.so
Expected in: dynamic lookup
So to summarise, at this stage Nothing has changed in my .emacs
file or my .emacs.d
directory from the original installation.
All changes done to my python package installation during the last two days are simply the installation of virtualenvwrapper
. At this stage I am quite lost . ANY help is much appreciated.
THANKS in advance for your time.
来源:https://stackoverflow.com/questions/31164285/emacs-python-jedi-suddenly-failing