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.

How to enable Python 3 support without compiling Python 3 within Vim?

See original GitHub issue

About half of the time I develop using Python 2 and the other half of the time I develop using Python 3. But it seems that Jedi is unable to understand that even though /usr/bin/env python will return in a Python 3 interpreter within those Python 3 virtualenvs and always goes to Python 2 instead. The result is that when I do a <leader>g I go to the Python 2 version instead of the Python 3 version which can be quite different.

I’ve tried forcing Jedi to use Python 3 using this setting:

let g:jedi#force_py_version = 3

But that results in:

Error: jedi-vim failed to initialize Python: Could not setup g:jedi#force_py_version: jedi#setup_py_version: Vim(py3file):E319: Sorry, the command is not available in this version: py3file ~/.vim/bun
dle/jedi-vim/initialize.py (in function jedi#init_python[3]..<SNR>98_init_python, line 6)```

Since I run Vim through homebrew (as most OS X developers would), I unfortunately can’t build both Python 2 and Python 3 support into Vim. The install options for Vim through homebrew:

--disable-nls
    Build vim without National Language Support (translated messages, keymaps)
--override-system-vi
    Override system vi
--with-client-server
    Enable client/server mode
--with-lua
    Build vim with lua support
--with-luajit
    Build with luajit support
--with-mzscheme
    Build vim with mzscheme support
--with-python3
    Build vim with python3 instead of python[2] support
--with-tcl
    Build vim with tcl support
--without-perl
    Build vim without perl support
--without-python
    Build vim without python support
--without-ruby
    Build vim without ruby support
--HEAD
    Install HEAD version

Is there any other way to fix this?

Thinking about it, even being able to modify the search path for GotoDefinition would probably fix the issue as well but I don’t see an option similar to that anywhere in the docs either.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
blueyedcommented, Jan 25, 2016

It works quite good for me using Neovim, which supports Python 2 and 3 in parallel better than Vim. But then I’m mostly working on Python 3 anyway.

What is <leader>g doing in your config? Is it based on virtualenvs?

0reactions
wolphcommented, Jan 25, 2016

Ok, I’ll give that a try. Thank you so much for the help 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to enable +python feature in vim
If you're on a Debian based system, the easiest way is to download the vim-gnome or vim-gtk package from apt ( apt install...
Read more >
Installing vim in order to enable python and python3 - Q&A
So I wanted to build vim from source, which I did. After that I've installed YouCompleteMe a vim plugin which is a code...
Read more >
How to enable python3 in vim? - Stack Overflow
Installing the prerequisite packages needed for Python 3 and for compiling Vim; Compile Vim with the configure --enable-python3interp option.
Read more >
IDE :: Compiling Vim with Python3 support - DEV Community ‍ ‍
Compile Vim with Python3 support. git clone https://github.com/vim/vim.git cd vim/src ./configure --enable-python3interp make sudo make ...
Read more >
Python support for Vim on Windows - Reddit
Yes, 3.7 support (+python3/dyn), so you'll need python37.dll which you'll have in your python installation directory when you install python 64-bit from python....
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