6

I am trying to get started with elpy but any python file I open elpy will complain and say

eldoc error: (error Elpy necessitates the ’virtualenv’ python package, please install it with ‘pip install virtualenv‘)

Even if I am editing files in a directory with a virtualenv and I have $WORKON_HOME set to that directory.

3

3 Answers 3

5

(setq elpy-rpc-virtualenv-path 'current) works for me.

1

I followed this tutorial, and got the same error. When I looked at the buffer elpy-virtualenv, it showed the error that I have no module named virtualenv installed. It also showed me this:

Elpy failed to install its dedicated virtualenv due to the above
error. If the error details does not help you fixing it, You can
report this problem on Elpy repository on github.
In the meantime, setting the `elpy-rpc-virtualenv-path' option to
either `global' or `current' should temporarily fix the issue.

So I added the line (setq elpy-rpc-virtualenv-path 'current) in my ~/.emacs.d/init.el file. That solved the problem "temporarily" as it said. The permanent solution is to install virtualenv via package manager. For Ubuntu and other debian-based Linux distro, it is easy: sudo apt install virtualenv.

1

it's all in the sudo apt install virtualenv

4
  • 1
    This doesn't explain much. Can you elaborate?
    – Drew
    Sep 10, 2020 at 19:23
  • The solution was to install virtualenv from apt, not pip. I migrated my .emacs file over from an old laptop and sure enough, forgot to install virtualenv so was running into the error, tried installing virtualenv from pip but as soon as I installed it from apt things started working and the error in subject was gone.
    – init0
    Sep 11, 2020 at 20:11
  • Put anything relevant in your answer - comments can be deleted at any time. Otherwise, the answer risks being deleted as unclear.
    – Drew
    Sep 11, 2020 at 20:19
  • So why doesnt the install of python3-venv cover this? It's all very very convoluted, confusing and messy.
    – RichieHH
    Mar 16, 2021 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.