Jedi-vim not use Conda environment
See original GitHub issueIssue
Jedi-vim knows python in my conda env, but not use it. Instead it just use the base conda environment. However it does use python in environment created by venv module.
Previously it worked OK for all env created with venv or conda, I’m currently on the latest version of jedi-vim.
Steps to reproduce
I create a new environment with conda create -n pytorch python=3.7
and installed pytorch.
Jedi knows about the environment but does not use it, so I can not autocomplete it with deoplete.
Output of “:verbose JediDebugInfo”
#### Jedi-vim debug information
##### jedi-vim version
- jedi-vim git version: f367497
- jedi git submodule status: bd1010bbd2693f189ff780eb21fc4294071cb280 pythonx/jedi (v0.13.1)
- parso git submodule status: a2b153e3c13c41ead7682e6891a51ec20d58d9b1 pythonx/parso (v0.3.2)
##### Global Python
Using Python version 3 to access Jedi.
- global sys.version: `3.7.2 (default, Dec 29 2018, 00:00:04), [Clang 4.0.1 (tags/RELEASE_401/final)]`
- global site module: `/Users/phucle/miniconda3/lib/python3.7/site.py`
##### Jedi
- path: `/Users/phucle/.local/share/nvim/plugged/jedi-vim/pythonx/jedi/jedi/__init__.py`
- version: 0.13.1
##### Jedi environment: <SameEnvironment: 3.7.2 in /Users/phucle/miniconda3>
- executable: /Users/phucle/miniconda3/bin/python
- sys_path:
- `/Users/phucle/miniconda3/lib/python37.zip`
- `/Users/phucle/miniconda3/lib/python3.7`
- `/Users/phucle/miniconda3/lib/python3.7/lib-dynload`
- `/Users/phucle/miniconda3/lib/python3.7/site-packages`
##### Known environments
- <Environment: 3.7.2 in /Users/phucle/miniconda3/envs/pytorch> (/Users/phucle/miniconda3/envs/pytorch/bin/python3.7) ==>> This should be the executable of jedi-vim.
- <Environment: 2.7.15 in /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7> (/usr/local/opt/python@2/bin/python2.7)
Create env with venv
If I create a new environment using python -m venv myenv
, jedi recognize and use the environment:
#### Jedi-vim debug information
##### jedi-vim version
- jedi-vim git version: f367497
- jedi git submodule status: bd1010bbd2693f189ff780eb21fc4294071cb280 pythonx/jedi (v0.13.1)
- parso git submodule status: a2b153e3c13c41ead7682e6891a51ec20d58d9b1 pythonx/parso (v0.3.2)
##### Global Python
Using Python version 3 to access Jedi.
- global sys.version: `3.7.2 (default, Dec 29 2018, 00:00:04), [Clang 4.0.1 (tags/RELEASE_401/final)]`
- global site module: `/Users/phucle/miniconda3/lib/python3.7/site.py`
##### Jedi
- path: `/Users/phucle/.local/share/nvim/plugged/jedi-vim/pythonx/jedi/jedi/__init__.py`
- version: 0.13.1
##### Jedi environment: <Environment: 3.7.2 in /Users/phucle/github/venv>
- executable: /Users/phucle/github/venv/bin/python
- sys_path:
- `/Users/phucle/miniconda3/lib/python37.zip`
- `/Users/phucle/miniconda3/lib/python3.7`
- `/Users/phucle/miniconda3/lib/python3.7/lib-dynload`
- `/Users/phucle/github/venv/lib/python3.7/site-packages`
##### Known environments
- <Environment: 3.7.2 in /Users/phucle/github/venv> (/Users/phucle/github/venv/bin/python)
- <Environment: 3.7.2 in /Users/phucle/miniconda3> (/Users/phucle/miniconda3/bin/python3.7)
- <Environment: 2.7.15 in /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7> (/usr/local/opt/python@2/bin/python2.7)
##### Settings
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
vim + conda environment : r/vim
I use neovim with jedi-vim. For the +python thing to work in neovim you need to install the package neovim (and jedi if...
Read more >how to change python interpreter used by jedi-vim
I was able to fix it myself by providing jedi-vim with the location of the packages in my anaconda folder using the $PYTHONPATH...
Read more >jedi
An autocompletion tool for Python that can be used for text editors. ... is why for example :Pyimport django.db did not work in...
Read more >Installation and Configuration — Jedi 0.18.2 documentation
The reason for this is that it makes sense that the plugin that uses Jedi has always access to it. Otherwise Jedi will...
Read more >Unanswered 'jedi-vim' Questions
I installed jedi-vim with Pathogen. I want it to use my anaconda python which is python 3.6 and not my system python. I...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just wanted to confirm that this solution worked for me too, for getting Jedi to use my active conda environment. I added to my .vimrc:
let $VIRTUAL_ENV = $CONDA_PREFIX
But it seems like this should be handled by jedi
Thanks; I’ll take a look at this and make a PR soon!