[Emacs] I had a problem installing the Python auto-completion package jedi (mac)

Introduction

·environment macOS Mojave 10.14.6 GNU Emacs 26.3

When I tried to install emacs-jedi on mac, I got hooked. Originally I was using jedi, but I tried to reinstall it because the environment of python itself changed. By the way, I remember it was hard when I first installed it.

By the way, here is the original setting.


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

Is mac and jedi incompatible? For example, there is such information. https://github.com/tkf/emacs-jedi/issues/346

Also, it's confusing to go to python in virtualenv by default ...

The situation at that time

I was able to install jedi itself from M-x package-list-package without any problems, but I got an error with M-x jedi: install-server.

 deferred error : (error "Deferred process exited abnormally:
  command: virtualenv
  exit status: exit 1
  event: exited abnormally with code 1
  buffer contents: \"FileExistsError: [Errno 17] File exists: '/usr/local/opt/[email protected]/bin/pytho\
n3.8' -> '/Users/username/.emacs.d/.python-environments/default/bin/python'
\"")

In the documentation http://tkf.github.io/emacs-jedi/latest/#jedi:install-server

The environment is in ~ / .emacs.d / .python-environments / default /

Because there is, I thought that it was because the old python environment remained here, so I deleted this


rm -r .emacs.d/.python-environments/default

Then I ran M-x jedi: install-server again, but I'm sorry I got the following error.

Traceback (most recent call last):
  File "/Users/username/.emacs.d/.python-environments/default/bin/jediepcserver", line 5, in <module\
>
    from jediepcserver import main
ModuleNotFoundError: No module named 'jediepcserver'

Process epc:server:3 exited abnormally with code 1

Solution

I was saved by this article ...! http://proglab.blog.fc2.com/blog-entry-46.html

To summarize this article

After all, I realized that if jedi, epc, jediepcserver are installed, I don't have to build a virtual environment with virtualenv ...


 pip install --upgrade ~/.emacs.d/elpa/jedi-core-What

To the configuration file (ex. ~ / .Emacs)


(setq jedi:server-command (list (executable-find "jediepcserver")))

Should be added.

So, I actually solved it with this even at my own hands!

Finally

The jedi is so convenient that I'm really grateful that it's back in use. If anyone knows an effective countermeasure against the above error, please let me know.

Recommended Posts

[Emacs] I had a problem installing the Python auto-completion package jedi (mac)
The story of introducing jedi (python auto-completion package) to emacs
I wanted to solve the ABC164 A ~ D problem with Python
Python: I tried the traveling salesman problem
I took a quick look at the fractions package that handles Python built-in fractions.
I tried Python on Mac for the first time.
A memo that I touched the Datastore with python
I tried to solve the problem with Python Vol.1
Python3 I don't know the balanced binary search tree, but I wish I had a sorted set.
I replaced the Windows PowerShell cookbook with a python script.
I checked the Python package pre-installed in Google Cloud Dataflow
I just changed the sample source of Python a little.
I made a package to filter time series with python
I tried "Implementing a genetic algorithm (GA) in python to solve the traveling salesman problem (TSP)"
Notes on installing Python on Mac
I made a python text
I downloaded the python source
A memorandum of understanding for the Python package management tool ez_setup
I made a package that can compare morphological analyzers with Python
I tried running the Python Package Repository (Warehouse) that supports PyPI
A story that struggled to handle the Python package of PocketSphinx
I created a Python library to call the LINE WORKS API
Solve the Python knapsack problem with a branch and bound method
I made a scaffolding tool for the Python web framework Bottle
After researching the Python library, I understood a little about egg.info.
[Mac] Create a Python3 execution environment from the fully initialized state
Solve the subset sum problem with a full search in Python
[Python] How to save the installed package and install it in a new environment at once Mac environment