Use python3 in Vim

949 views
Skip to first unread message

Patrick Kasarski

unread,
Jan 5, 2017, 6:13:31 PM1/5/17
to powerline
I am using Ubuntu 16.10. The version of Vim that is packaged has only Python 3 support. I.e. :version shows: -python +python3.

My understanding is that Powerline does work with python3. However, I get
E319: Sorry, the command is not available in this version: python from powerline.vim import setup as powerline_setup
E319: Sorry, the command is not available in this version: python powerline_setup()
E319: Sorry, the command is not available in this version: python del powerline_setup

What seems to be happening here is that Powerline is trying to use the python (Python 2) module instead of python3. This seems to be the same issue that was apparently patched in Fedora's package: https://bugzilla.redhat.com/show_bug.cgi?id=1323828

Is there some way to configure it to use python3? Really, it makes more sense IMO to try python3 first, and then fall back to python (2).

Thanks,
Patrick

Patrick Kasarski

unread,
Jan 5, 2017, 6:27:27 PM1/5/17
to powerline
Well, I figured it out. The python command is coming from my .vimrc, so I just needed to change it there (to python3). And then it couldn't find the powerline package, because it was installed by pip rather than pip3. So remove the pip version and install powerline again using pip3 worked. 

Nikolay Aleksandrovich Pavlov

unread,
Jan 5, 2017, 7:18:11 PM1/5/17
to Patrick Kasarski, powerline
2017-01-06 2:27 GMT+03:00 Patrick Kasarski <pkas...@gmail.com>:
> Well, I figured it out. The python command is coming from my .vimrc, so I
> just needed to change it there (to python3). And then it couldn't find the
> powerline package, because it was installed by pip rather than pip3. So
> remove the pip version and install powerline again using pip3 worked.

If you used powerline.vim file from distribution instead of supplying
:py commands it would try :py3 if :py is not available. But, of
course, this will not fix the problem with installation.

Using :py commands directly is still one of the official ways to use
powerline; do not remember why exactly it became/continues to be
official, but powerline.vim has overhead for troubleshooting and
detecting needed Python version, also I personally use :py commands
directly as well.

>
>
> On Thursday, January 5, 2017 at 5:13:31 PM UTC-6, Patrick Kasarski wrote:
>>
>> I am using Ubuntu 16.10. The version of Vim that is packaged has only
>> Python 3 support. I.e. :version shows: -python +python3.
>>
>> My understanding is that Powerline does work with python3. However, I get
>> E319: Sorry, the command is not available in this version: python from
>> powerline.vim import setup as powerline_setup
>> E319: Sorry, the command is not available in this version: python
>> powerline_setup()
>> E319: Sorry, the command is not available in this version: python del
>> powerline_setup
>>
>> What seems to be happening here is that Powerline is trying to use the
>> python (Python 2) module instead of python3. This seems to be the same issue
>> that was apparently patched in Fedora's package:
>> https://bugzilla.redhat.com/show_bug.cgi?id=1323828
>>
>> Is there some way to configure it to use python3? Really, it makes more
>> sense IMO to try python3 first, and then fall back to python (2).
>>
>> Thanks,
>> Patrick
>
> --
> You received this message because you are subscribed to the Google Groups
> "powerline" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to powerline-supp...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages