elpy icon indicating copy to clipboard operation
elpy copied to clipboard

elpy goto definition not working after activating virtual env

Open dnaeon opened this issue 2 years ago • 1 comments

Summary

Hey, there! First, thanks for making elpy, much appreciated!

Steps to reproduce

  1. Open a .py file from existing project.
  2. M-. works as expected and I'm able to jump to the definitions within the project
  3. Activate a virtual env using M-x pyvenv-activate.
  4. M-. no longer works, even for symbols within the same project, which worked fine in step 2 before activating the environment
  5. Deactivate the virtualenv using M-x pyvenv-deactivate - jump to definition for symbols local to the project works again, but not for symbols within the virtualenv, e.g. a class provided by another package and located within the same venv

Something else to mention here -- M-x elpy-doc works fine, it's just that the jumping to definition does not.

Tried downgrading to jedi < 0.18 -- no change. Tried recreating the virtulaenv -- no change.

My configuration

OS

  • Arch Linux

Result of (elpy-config)

Elpy Configuration

Emacs.............: 28.2
Elpy..............: 1.35.0
Virtualenv........: venv (/home/dnaeon/Projects/../my-project/venv/)
Interactive Python: python3 3.9.5 (/home/dnaeon/Projects/.../my-project/venv/bin/python3)
RPC virtualenv....: rpc-venv (/home/dnaeon/.emacs.d/elpy/rpc-venv)
 Python...........: python 3.10.9 (/home/dnaeon/.emacs.d/elpy/rpc-venv/bin/python)
 Jedi.............: 0.18.2
 Autopep8.........: 2.0.1
 Yapf.............: 0.32.0
 Black............: 23.1.0
Syntax checker....: Not found (flake8)

Warnings

The configured syntax checker (flake8) could not be found. Elpy uses
this program to provide syntax checks of your code. You can either
install it, or select another one using `elpy-syntax-check-command`.

Elpy configuration in my init.el

(use-package elpy
  :ensure t
  :defer t
  :config
  (add-hook 'elpy-mode-hook (lambda () (highlight-indentation-mode -1)))

dnaeon avatar Feb 14 '23 07:02 dnaeon

you can check elpy-config with and without virtual env and see if there's any differences.

yitang avatar Feb 17 '23 07:02 yitang