Ultisnips: Ultisnips requires py >= 2.7 or py3

Created on 5 Jun 2016  Â·  21Comments  Â·  Source: SirVer/ultisnips

Hi,everybody.

Issus:
Recently, I install the ultisnips for my vim7.4 which was compiled by myself, but ,after installing the plugin the vim reminds me that "Ultisnips requires py >= 2.7 or py3".

My checks:
What confused me is that python is supported by my vim. For python3, it is just "-" in my vim version. So I guess that py suppoeted by my vim is lower version than py2.7. There is a picture about the message in the end.

My tries:
In terminal, I type "python --version", and got the message that "Python 2.7.6". Obviously, my py version is higher.

Hlep me:
Now, what should i do?

Thanks!

Most helpful comment

@seletskiy :So happy! I have solved it by reinstalling with new config parameters.
It is as follows: Firstly, I uninstall the current vim. Secondly, I recompile vim7.4 with new config parameters as

sudo ./configure –enable-multibyte \
            --enable-fontset \
            --enable-xim \
            --enable-gui=auto \
            --enable-luainterp=dynamic \
            --enable-pythoninterp=yes \
            --enable-rubyinterp=dynamic \
            --enable-perlinterp \
            --enable-cscope \
            --enable-sniff \
            --with-x \
            --with-compiledby=erocpil \
            --with-features=huge \
            --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu

Then, vim was installed successfully. And The issue that I asked disappeared.

Contrasted with old config parameters of vim, there is only a difference, that is the parameter ---- "--enable-pythoninterp" ---- is "yes" or "dynamic". The old one is "--enable-pythoninterp=dynamic", which leads to the “py library can't be loaded”. If this parameter is "yes", all the problems are solved.But the reason is still unclear for me.

Anyway, I appreciate you very much!

All 21 comments

@Oliver8668: What is output of the :py import sys; print(sys.version_info) command?

@seletskiy :I type the ":py import sys; print(sys.version_info)" command in terminal, this is what you said, right?
I am a new guy for ubuntu system, so I can not get you, sorry

@Oliver8668: No, you should type it in your vim instance.

@seletskiy : OK, I did it as what you said, and got two error as follow:

screenshot from 2016-06-06 10 12 01

So why? what should I do to deal with it?

@Oliver8668: You should install vim with python support using your package manager (apt).

@seletskiy :So happy! I have solved it by reinstalling with new config parameters.
It is as follows: Firstly, I uninstall the current vim. Secondly, I recompile vim7.4 with new config parameters as

sudo ./configure –enable-multibyte \
            --enable-fontset \
            --enable-xim \
            --enable-gui=auto \
            --enable-luainterp=dynamic \
            --enable-pythoninterp=yes \
            --enable-rubyinterp=dynamic \
            --enable-perlinterp \
            --enable-cscope \
            --enable-sniff \
            --with-x \
            --with-compiledby=erocpil \
            --with-features=huge \
            --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu

Then, vim was installed successfully. And The issue that I asked disappeared.

Contrasted with old config parameters of vim, there is only a difference, that is the parameter ---- "--enable-pythoninterp" ---- is "yes" or "dynamic". The old one is "--enable-pythoninterp=dynamic", which leads to the “py library can't be loaded”. If this parameter is "yes", all the problems are solved.But the reason is still unclear for me.

Anyway, I appreciate you very much!

@Oliver8668: :+1:

@MichaelDiao Here i hit the issue when i build VIM8.0 from the sources code.....

Issus:
Recently, I install the ultisnips for my vim8.0 which was compiled by myself, but ,after installing the plugin the vim reminds me that "Ultisnips requires py >= 2.7 or py3".

My checks:
I checked my python installed is python2.7.11

My tries:
In terminal, I type "python --version", and got the message that "Python 2.7.11". Obviously, my py version is higher.

please help.

vim

here is the screen shoot.

thanks.

@Wenchao21 , once you have started up vim, if you type ":py import sys; print(sys.version_info)" what result do you have ?

py

Happen on windows with python installed:

shell git-bash

$ python
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
$ vim
UltiSnips requires py >= 2.7 or py3
Press ENTER or type command to continue
$ vim -version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan 25 2017 09:05:56)
Garbage after option argument: "-version"
More info with: "vim -h"

alias:

alias python='winpty python.exe'

try ":py import sys; print(sys.version_info)" :
image

I encountered the same problem after update my VIM to 8.1 from 8.0.
This is the result of :py import sys; print(sys.version_info)
image

I got Python 2.7.10 by python ---version, and I tried adding --enable-pythoninterp=yes while compiling VIM8.1, but it doesn't work.

I had fixed it with this command:"apt install vim-gtk"

I followed that:
https://github.com/zchee/deoplete-jedi/wiki/Setting-up-Python-for-Neovim

seems to have solved the issue.

I had this issue after but solved it by running sudo apt install vim-gtk

I had fixed it with this command:"apt install vim-gtk"
It works for me

When configuring vim, make sure that you enabled either python2 or python3, not both.
https://vi.stackexchange.com/a/12925

I had fixed it with this command:"apt install vim-gtk"

This fixed it for me too.

Running :
VIM 8.0 (2016 Sp 12, compiled Sep 30 2017 18:21:38)
MX Linux 9 (Debian Stretch) Kernel: Linux 4.19.0-1-amd64

To anyone trying to run vim with python3: replace --enable-pythoninterp by --enable-python3interp

I had fixed it with this command:"apt install vim-gtk"

I did what you said and it fixed

Was this page helpful?
0 / 5 - 0 ratings