jedi-vim does not actually use virtualenv
See original GitHub issueIssue
It states in the documentation that it “Supports virtualenv”, but It does not work for me.
Steps to reproduce
I have a project directory and inside I have a venv folder that was created with:
virtualenv -p /usr/local/bin/python3 venv
I source this venv with the usual command:
source venv/bin/activate
I install some packages in this venv: hamcrest and requests
I start vim in this directory
result of :! python --version
is Python 3.4.1
I go to a file in my project that uses either hamcrest or requests, I do <leader>d, it works, but when I check the path of the file it went to is actually on/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/hamcrest/__init__.py
I uninstall hamcrest from my system python 2.7.13
I start vim again and go to that file, do <leader>d:
“jedi-vim: Couldn’t find any definitions for this.”
My conclusion is that in reality jedi-vim does not actually use the virtual env…
Versions
- jedi-vim: no idea
- Vim version 8
- Python: 2.7, 3.4.1, 3.5.2
Issue Analytics
- State:
- Created 7 years ago
- Reactions:25
- Comments:25 (9 by maintainers)
Top GitHub Comments
@xarthurx I use a simple hack to be able to get completions when changing the virtualenv inside vim. I do this by changing the
g:deoplete#sources#jedi#python_path
variable each time that the virtual environment is changes viaVirtualEnvActivate
(link to code). It is maybe not the best solution, but it works.ATM I use neovim with neovim (pep8 and yapf) python package(s) installed inside given virtual env.
With this configuration if I source my venv before opening neovim completion and doc are available from given virtual env.
I also use deoplete for completion and ale for syntax checking (both are async).
This setup is (at least for me) the perfect setup for python development using [neo]vim.
Check my .vimrc for configuration details
Let me know your through.