question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jedi-vim does not actually use virtualenv

See original GitHub issue

Issue

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:closed
  • Created 7 years ago
  • Reactions:25
  • Comments:25 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
cristobaltapiacommented, Jun 7, 2019

@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 via VirtualEnvActivate (link to code). It is maybe not the best solution, but it works.

2reactions
WnPcommented, Feb 28, 2018

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

r/neovim - Although I enable venv, the jedi still indicates that ...
I wonder if I'm doing something wrong because I believe activating venv should recognize that it's installed in this virtual environment. I would...
Read more >
Jedi-vim autocompletion python3.6 virtualenv not working
I got it working with my pyenv-virtualenv, vim and jedi setup after a long hours. Hope it helps you. First I added the...
Read more >
How to run autocomplete(JEDI) inside virtualenv in vim
So, I basically switched to neovim and realized that autocomplete does not work when you're inside the virtualenv using the the vim editor...
Read more >
jedi - PyPI
You can run Jedi on Python 3.6+ but it should also understand code that is older than those versions. Additionally you should be...
Read more >
Jedi Documentation
on Linux/Mac, because readline is not available on Windows. If you still want Jedi autocompletion in your REPL, just use IPython instead:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found