You are not logged in.

#1 2020-03-21 21:00:28

Hounddog
Member
Registered: 2012-12-26
Posts: 9

Vim unable to load python 3 [SOLVED]

Hi, I'm having what looks like this issue,

https://bbs.archlinux.org/viewtopic.php?id=221579

and I wanted to see if anyone else could reproduce?

I'm running the latest version of python 3 (python 3.8.2-1) and vim from the gvim package (gvim 8.2.0343-1).  This problem also produces with the regular vim package.

I first noticed this problem trying to load vim with youcompleteme, (provides error message "YouCompleteMe unavailable: unable to load Python."), but it doesn't appear to be a plugin problem, if you run

py3 pass

from within vim, you get:

E837: This Vim cannot execute :py3 after using :python
E263: Sorry, this command is disabled, the Python library could not be loaded.

On the linked issue above, this issue occurred because the python3 package was updated, and vim was not rebuilt. Can someone else confirm this issue?  All you have to do is update vim and python3, then try and run a python command from within vim.

Thanks!

Last edited by Hounddog (2020-03-21 21:41:47)

Offline

#2 2020-03-21 21:11:29

Scimmia
Fellow
Registered: 2012-09-01
Posts: 9,433

Re: Vim unable to load python 3 [SOLVED]

Your error is completely different. You can use python2 or you can use python3. The error says you have already loaded python2, which means you can't then load python3.

Offline

#3 2020-03-21 21:31:53

Hounddog
Member
Registered: 2012-12-26
Posts: 9

Re: Vim unable to load python 3 [SOLVED]

Thanks!  Do you know offhand how I could convince vim to load python3 instead of python2?

Offline

#4 2020-03-21 21:40:36

Hounddog
Member
Registered: 2012-12-26
Posts: 9

Re: Vim unable to load python 3 [SOLVED]

Double posting because I figured out a "solution" (not really a solution to my problem, but at least and explanation for what's happening).

When python is dynamically loaded vim can only load either python2 or python3.  In my config file, powerline is apparently loaded first, and it's pulling up python2.  When ycm tries to get loaded next, it can't load python3 because powerline has already loaded python2. 

Marking as "solved" as vim is behaving as intended, and this is just a problem with my plugins.

EDIT:  if anyone stumbles upon this with the exact same problem I had, it looks like powerline is fine with using python3 if it's already loaded, so just put powerline after ycm in your vimrc.

Last edited by Hounddog (2020-03-21 21:43:49)

Offline

#5 2020-03-22 01:46:04

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Vim unable to load python 3 [SOLVED]

Ideally though, powerline would use python3 by default. Might be worth submitting a bug report upstream.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#6 2020-04-30 19:05:27

adrianopinaffo
Member
Registered: 2020-04-30
Posts: 1

Re: Vim unable to load python 3 [SOLVED]

Hounddog wrote:

Double posting because I figured out a "solution" (not really a solution to my problem, but at least and explanation for what's happening).

When python is dynamically loaded vim can only load either python2 or python3.  In my config file, powerline is apparently loaded first, and it's pulling up python2.  When ycm tries to get loaded next, it can't load python3 because powerline has already loaded python2. 

Marking as "solved" as vim is behaving as intended, and this is just a problem with my plugins.

EDIT:  if anyone stumbles upon this with the exact same problem I had, it looks like powerline is fine with using python3 if it's already loaded, so just put powerline after ycm in your vimrc.

Thank you very much Hounddog, I had the exact same problem and I fixed by changing the order of powerline and youcompleteme. The only other thing I had to do after that was to run :PluginUpdate (using Vundle here), then restart all sessions vim.

Offline

Board footer

Powered by FluxBB