Vim: how to install the UltiSnips plugin?
Asked Answered
D

3

7

I tried installing the UltiSnips plugin, but when Vim is loaded it creates a torrent of errors:

Error detected while processing C:\Documents and Settings\username\vimfiles\bundle\UltiSnips-2.2\plugin\UltiSnips.vim:
line  226:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named os
line  229:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Documents and Settings\username\vimfiles\bundle\UltiSnips-2.2\pl
ugin\UltiSnips\__init__.py", line 4, in <module>
    from functools import wraps
ImportError: No module named functools
line  230:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'UltiSnips_Manager' is not defined
line  231:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'UltiSnips_Manager' is not defined
line  232:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'UltiSnips_Manager' is not defined

What I did:

I installed the pathogen plugin, then extracted the contents of 'UltiSnips-2.2.tar.gz' to 'vimfiles/bundle/'

What I found for install instructions:

http://www.vim.org/scripts/script.php?script_id=2715

The instructions only refer to concept of 'installing' as indicating how to get the source code. There are no step by step instructions. After a cursory glance I am lead to believe that the contents of 'UltiSnips-2.2.tar.gz' (provided directly on that page) is identical to the contents of the git repository.

Edit with more information:

This is gvim on windows XP. :echo has("python") returns 1.

The relevant bits of :version regarding python is:

+python/dyn -python3
-DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL="python26.dll"

full contents of :version:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jan  4 2011 14:09:41)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1-98
Compiled by [email protected]
Huge version with GUI.  Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info 
+comments +conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con_gui +diff +digraphs -dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search 
+farsi +file_in_path +find_in_path +float +folding -footer +gettext/dyn -hangul_input +iconv/dyn +insert_expand +jumplist +keymap +langmap +libcall
 +linebreak +lispindent +listcmds +localmap +lua/dyn +menu +mksession +modify_fname +mouse +mouseshape +multi_byte_ime/dyn +multi_lang 
+mzscheme/dyn +netbeans_intg +ole -osfiletype +path_extra +perl/dyn +persistent_undo -postscript +printer +profile +python/dyn -python3 +quickfix 
+reltime +rightleft +ruby/dyn +scrollbind +signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary +tag_old_static 
-tag_any_white +tcl/dyn -tgetent -termresponse +textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo 
+vreplace +wildignore +wildmenu +windows +writebackup -xfontset -xim -xterm_save -xpm_w32 
   system vimrc file: "$VIM\vimrc"
     user vimrc file: "$HOME\_vimrc"
 2nd user vimrc file: "$VIM\_vimrc"
      user exrc file: "$HOME\_exrc"
  2nd user exrc file: "$VIM\_exrc"
  system gvimrc file: "$VIM\gvimrc"
    user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$VIM\_gvimrc"
    system menu file: "$VIMRUNTIME\menu.vim"
Compilation: gcc -O3 -fomit-frame-pointer -freg-struct-return -fno-strength-reduce -DWIN32 -DHAVE_PATHDEF -DFEAT_HUGE -DWINVER=0x0400 -D_WIN32_WINNT=0x0400 -DFEAT_PERL -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL="perl58.dll" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL="python26.dll" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL="msvcrt-ruby18.dll" -DDYNAMIC_RUBY_VER=18 -DFEAT_MZSCHEME -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL="libmzsch42.dll" -DDYNAMIC_MZGC_DLL="libmzgc42.dll" -DINCLUDE_MZSCHEME_BASE -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL="tcl85.dll" -DFEAT_LUA -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL="lua51.dll" -DDYNAMIC_GETTEXT -DDYNAMIC_ICONV -DFEAT_MBYTE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG -DFEAT_GUI_W32 -DFEAT_CLIPBOARD -DFEAT_OLE -march=i386 -Iproto -I/cygdrive/c/strawberry/perl/lib/CORE -I/cygdrive/c/RUBY/lib/ruby/1.8/i386-mswin32 -I/cygdrive/c/PROGRA~1/MzScheme/include -I/cygdrive/c/Tcl/include -I/cygdrive/c/PROGRA~1/Lua/5.1/include -s -mno-cygwin
Linking: gcc -s -o gvim.exe  -luuid -lole32 /cygdrive/c/Tcl/lib/tclstub85.lib -lwsock32 -mwindows -lcomctl32 -lversion -loleaut32 -lstdc++
Disepalous answered 15/5, 2013 at 2:34 Comment(4)
Can you do a vim --version | grep python you should see a +python if you don't you need to recompile vim with python support. (Otherwise I think you installed it correctly. If you didn't you wouldn't have gotten the errors)Dynamism
UtilSnips is a python-written plugin so you need a python environment first. According to your error log, it seems that your vim has been compiled with python support but python can't run correctly. Install python (if not) and make sure it can run correctly. (launch it in command line, for example)Harbot
Can you launch python of the command line and type import os and see if it throws errors. It looks like you might have a crippled version of python. (you might need to reinstall more libraries for it)Dynamism
It looks like the solution was to install python 2.6, and add the path to the .dll to the "PATH" environment variable. I will mark either of first two comments as the accepted answer if you repost it as an answer.Disepalous
D
1

Make sure vim has been compiled with python support. You can check this by running

vim --version | grep python

and looking for +python or run echo has('python') and see if it outputs 1.

If vim has been compiled with python support make sure that python (2) is in your PATH.

Dynamism answered 31/8, 2013 at 1:33 Comment(0)
S
0

If you do not have root access, other option is to downgrade version of ultisnips to 1.3. You can do that by running following command after git clone.

git checkout tags/1.3

There is compromise but it works!

Shela answered 26/2, 2014 at 6:37 Comment(0)
P
0

I encountered the same problem and had to resort to having multiple installations of Python. My current working setup has gVim7.4, Python2.7.9 (only for UltiSnip :-/) and Python3.4 (this is the one I work with).

Podium answered 11/1, 2015 at 22:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.