1

When I try to use jedi package I get following message in the minibuffer.

This feature requires the ‘jedi‘ package to be installed. Please check ‘elpy-config‘ for more information.

Elpy Configuration

Emacs.............: 26.3
Elpy..............: 1.34.0
Virtualenv........: venv (/home/alper/venv)
Interactive Python: python3 3.7.5 (/home/alper/venv/bin/python3)
RPC virtualenv....: rpc-venv (/home/alper/.emacs.d/elpy/rpc-venv)
 Python...........: python 3.7.5 (/home/alper/.emacs.d/elpy/rpc-venv/bin/python)
 Jedi.............: 0.17.2
 Rope.............: 0.16.0
 Autopep8.........: 1.5.3 (1.5.4 available)
 Yapf.............: 0.29.0 (0.30.0 available)
 Black............: 19.10b0 (20.8b1 available)
Syntax checker....: flake8 (/home/alper/venv/bin/flake8)

After few minutes it starts working or when I restart emacs there are some cases that it starts working right way. So its behavior is random for its load time to start.

=> Is there anything I can do to prevent this error to force jedi to start right away? or is this a normal behavior of jedi?

Please note that I had similiar question (elpy - This feature requires the ‘jedi‘ package to be installed), but it was not related to jedi package's load time.

Drew
  • 75,699
  • 9
  • 109
  • 225
alper
  • 1,238
  • 11
  • 30

1 Answers1

1

While switching configurations I've came across this issue yet again and I believe I have a workaround for this if you're still interested.

The steps I do to reproduce:

  • start fresh emacs,
  • venv-workon to activate a virtualenv,
  • open a python buffer,
  • try elpy-goto-definition, receive the same error message you did.
  • (elpy-config confirms everything is ok)

Now, I was under the impression that elpy-goto-definition will just utilize the same mechanism as xref-find-definitions, but apparently that's not exactly the case. If I try to run the latter, something else happens the first time around (which might be triggering the connection to rpc) and I get a different error message. But the second time around it is already connected and I can use it at will.

This is assuming that xref-backend-functions includes elpy-xref-backend.

Please let me know if this solves the issue and if you have dug deeper to explain the reasoning behind the bug.

  • Sorry I didn't get it. What changes should I do to my `init.el` file to achieve your workaround? – alper Apr 03 '21 at 15:43
  • With your current config try calling `xref-find-defiitions` twice right after startup and let me know if the second call gives you the expected result. – Tomasz Grining Apr 11 '21 at 13:44