Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should jedi-vim respect the preferred python interpreter of $PATH? #583

Closed
kiryph opened this issue Jun 18, 2016 · 4 comments
Closed

Should jedi-vim respect the preferred python interpreter of $PATH? #583

kiryph opened this issue Jun 18, 2016 · 4 comments

Comments

@kiryph
Copy link

kiryph commented Jun 18, 2016

I am on OSX 10.10.5 using MacVim. I have installed miniconda 2.3.0 (py27, numpy, pip installed jedi).
In my shell I have adjusted $PATH in ~/.profile, so that the default interpreter is the miniconda version

❯ which -a python
/Users/kiryph/miniconda-py2/bin/python
/usr/bin/python

I have adjusted in my vimrc also the PATH variable

let $PATH=""
            \.$HOME."/miniconda-py2/bin/:"
            \.$PATH

NOTE :!echo $PATH does not have the same order as :echo $PATH. Does anyone know why the order is changed?

Would it be sensible that jedi-vim completes according to the default python interpreter of $PATH, here the conda root environment ($ conda env list)?

@davidhalter
Copy link
Owner

Would it be sensible that jedi-vim completes according to the default python interpreter of $PATH

Well, I don't know if sensible is the right word to use here. jedi-vim doesn't do any magic in selecting a Python interpreter at the moment. jedi-vim is just using the Python interpreter given by vim itself. So there's not really a lot to adjust there.

I have davidhalter/jedi#385 on the roadmap as a long term solution for this, but it might take a while...

Is this answer good enough?

@kiryph
Copy link
Author

kiryph commented Jun 19, 2016

Yes, this answer is good enough. Thanks for your explanation.

I hope that you find the time to make it possible to choose the python interpreter. There is another plugin which tries to solve it for conda envs https://github.com/cjrh/vim-conda.
And compare also https://github.com/zchee/deoplete-jedi which has a variable for the python interpreter.

@kiryph kiryph closed this as completed Jun 19, 2016
@djchou
Copy link

djchou commented Jun 23, 2018

I've found that I can get jedi-vim to work with my python 2.7 conda environment.

Here's what I had to do:
(1) make sure i had an up-to-date vim that was compiled with python 2.7. I used brew with the following arguments:
brew install vim --with-python@2

(2) Make sure "vi" -> "vim". (I use "vi" in the command line. If you use "vim", you should be good. I did this by adding this line to my .bash_profile.
alias vi=vim
for the longest time, vi kept crashing on me until i checked :version in vi and realized it wasn't the same version that had been brew installed.

(3) The final piece is to add the following line to my .vimrc file
let g:jedi#force_py_version=2.7
This line forces jedi to use python version 2.7. Without this line, jedi tries to use version 3.x

I hope this helps someone. I spent all day troubleshooting but fortunately, I learned a lot in the process.

@kiryph
Copy link
Author

kiryph commented Jun 23, 2018

@djchou Thanks for your comment. It is always good when people share their solutions.

Also keep in mind not all people respond to solutions they found and actually helped them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants