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.


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

| improve this answer | |

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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