[vim] VIM and Python with Windows (#526)

138 views
Skip to first unread message

Zach Queal

unread,
Dec 11, 2015, 5:14:13 PM12/11/15
to vim/vim

I have Python 2.7.10 x64 installed along with Vim 7.4 x64 compiled with both +python/dyn and +python3/dyn support.

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 11 2015 11:37:42)
MS-Windows 64-bit console version
Included patches: 1-965
Compiled by veegee@veegee-win8
Huge version without GUI.  Features included (+) or not (-):
+acl             +eval            +mouse           +syntax
+arabic          +ex_extra        -mouseshape      +tag_binary
+autocmd         +extra_search    +multi_byte      +tag_old_static
-balloon_eval    +farsi           +multi_lang      -tag_any_white
-browse          +file_in_path    -mzscheme        -tcl
++builtin_terms  +find_in_path    -netbeans_intg   -tgetent
+byte_offset     +float           +path_extra      -termresponse
+cindent         +folding         -perl            +textobjects
+clientserver    -footer          +persistent_undo +title
+clipboard       +gettext/dyn     -postscript      -toolbar
+cmdline_compl   -hangul_input    +printer         +user_commands
+cmdline_hist    +iconv/dyn       +profile         +vertsplit
+cmdline_info    +insert_expand   +python/dyn      +virtualedit
+comments        +jumplist        +python3/dyn     +visual
+conceal         +keymap          +quickfix        +visualextra
+cryptv          +langmap         +reltime         +viminfo
+cscope          +libcall         +rightleft       +vreplace
+cursorbind      +linebreak       -ruby            +wildignore
+cursorshape     +lispindent      +scrollbind      +wildmenu
+dialog_con      +listcmds        +signs           +windows
+diff            +localmap        +smartindent     +writebackup
+digraphs        +lua/dyn         -sniff           -xfontset
-dnd             +menu            +startuptime     -xim
-ebcdic          +mksession       +statusline      -xterm_save
+emacs_tags      +modify_fname    -sun_workshop    -xpm_w32

While running Vim :echo has('python') returns 1.

I was able to get it working long enough to install a single plugin with Plug which requires Python support. After changing nothing, it's now no longer working.

Additionally, I can clean plugins just fine:

1 Searching for unused plugins in C:\Users\zqueal\.vim\plugged
2 [=====]                                                              
3                                                                      
4 Already clean.

This would leave me to believe that it's at least working intermittently. However, when running :python import sys; print(sys.version) I get:

E887: Sorry, this command is disabled, the Python's site module could not be loaded.

Anyone able to help me out, here?


Reply to this email directly or view it on GitHub.

Yukihiro Nakadaira

unread,
Dec 14, 2015, 3:32:07 AM12/14/15
to vim/vim

Do you have multiple python27.dll in your system? Such as py2exe application. If so, try setting 'pythondll' option to system wide python27.dll path.

Yukihiro Nakadaira

unread,
Dec 14, 2015, 3:47:08 AM12/14/15
to vim/vim

Ahh sorry, 'pythondll' is unix only option.

Charles

unread,
Dec 14, 2015, 4:55:25 AM12/14/15
to vim/vim

The pyv error is from https://github.com/junegunn/vim-plug/blob/master/plug.vim#L831

Is the folder where python27.dll resides exist in the PATH environment?
You can also try to set the PYTHON_HOME environment variable to the python installation folder. Sometimes it is not found correctly. To change windows environment variables I suggest something like RapidEE [1]

[1] http://www.rapidee.com/

Yukihiro Nakadaira

unread,
Dec 14, 2015, 6:34:06 AM12/14/15
to vim/vim

I confirmed that vim + python-2.7.11 doesn't work. And vim + python-2.7.10 does work.
Python-2.7.11 distribution seems broken. See http://bugs.python.org/issue25824.

Zach Queal

unread,
Dec 14, 2015, 10:49:07 AM12/14/15
to vim/vim

Closed #526.

Zach Queal

unread,
Dec 14, 2015, 10:49:07 AM12/14/15
to vim/vim

I confirmed that vim + python-2.7.11 doesn't work. And vim + python-2.7.10 does work.

This was it! Thanks for the help, gentlemen.

Charles

unread,
Dec 14, 2015, 8:08:03 PM12/14/15
to vim/vim

Python on windows works fine without the registry. There are more ways where python determine its home path. I'm currently using python 2.7.11 with vim.

vim

Zach Queal

unread,
Dec 15, 2015, 9:11:28 AM12/15/15
to vim/vim

Well, not sure why you're able to work with Python 2.7.11, but Python was correctly installed and in my path but Vim just couldn't recognize it. I have no problem working with 2.7.10 if it fixes the issue I was having.

micbou

unread,
Dec 15, 2015, 12:50:50 PM12/15/15
to vim/vim

@char101 Are you using the official python 2.7.11 installer? I don't get the same info as you:

Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32

micbou

unread,
Dec 15, 2015, 3:20:19 PM12/15/15
to vim/vim

I confirmed that vim + python-2.7.11 doesn't work. And vim + python-2.7.10 does work.

Python-2.7.11 distribution seems broken. See http://bugs.python.org/issue25824.

@ynkdir I don't think this is exactly the same issue. It only concerns the 32-bit installer, not the 64-bit one.

Zach Queal

unread,
Dec 15, 2015, 3:48:08 PM12/15/15
to vim/vim

Are you using the official python 2.7.11 installer?

Of course.

It only concerns the 32-bit installer, not the 64-bit one.

I installed the x64 installer.... So.

micbou

unread,
Dec 15, 2015, 3:54:23 PM12/15/15
to vim/vim

Of course.

I was asking to @char101. His python version:

2.7.11 (default, Dec  9 2015, 16:33:12) [MSC v.1900 64 bit (AMD64)]

is different than the one I get from the official python installer:

Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32

It is compiled with a different version of MSVC so I suspect that he is using a custom build.

I installed the x64 installer.... So.

I was talking about the python bug report.

Charles

unread,
Dec 15, 2015, 8:00:36 PM12/15/15
to vim/vim

I compiled python myself. My point is that you can make it work by setting PYTHONHOME/PYTHON_HOME environment variable because the registry is not the only place Python use to find its home path. If you use the installer then python will probably use the registry to find its home path, then you can probably just rename the registry key as written in the python bug report to make it work.

HKLM\Software\Wow6432Node\Python\PythonCore\2.7\PythonPath
->
HKLM\Software\Wow6432Node\Python\PythonCore\2.7-32\PythonPath

By the way I embed python directly into the vim directory, and compress and the python standard libraries into one zip file.

vim2

micbou

unread,
Dec 15, 2015, 8:40:48 PM12/15/15
to vim/vim

Thanks for the answer. Yes, setting the PYTHONHOME variable to the Python path or changing the folder in the registry from:
HKLM\Software\Python\PythonCore\2.7
to
HKLM\Software\Python\PythonCore\2.7-32
will work (note that the path is not the same for python 64-bit). Not obvious because the python report was about the 32-bit installer. I added a comment to clarify this.

Kazuki Sakamoto

unread,
Dec 15, 2015, 8:41:16 PM12/15/15
to vim/vim

PYTHONHOME environment variable doesn't work if your Vim was compiled with PYTHON_HOME define. See #500.

Zach Queal

unread,
Dec 15, 2015, 9:00:48 PM12/15/15
to vim/vim

After restarting having Python 2.7.10 no longer worked. I uninstalled all versions of Python starting from scratch again. Then setting PYTHONHOME to C:\Python27 seems to have worked;

Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec  5 2015 19:54:14)
MS-Windows 32-bit console version
Included patches: 1-954
Compiled by hp@HP-PC
Huge version without GUI.

All of my Python plugins are working again and :echo has('python') is back to 1. I really appreciate the help, guys!

K.Takata

unread,
Jun 30, 2016, 5:30:27 PM6/30/16
to vim/vim

Python 2.7.12 has been released.
I confirmed that the problem was fixed with Python 2.7.12.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

ARIT MISTRI

unread,
Aug 24, 2021, 9:20:01 PM8/24/21
to vim/vim, vim-dev ML, Manual

But in python 3.7 32 bit how can i configure vim in Windows 10


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

K.Takata

unread,
Aug 25, 2021, 2:27:03 AM8/25/21
to vim/vim, vim-dev ML, Manual

(Note that this issue is about python 2.7, not about 3.7.)
If you use the latest version from vim-win32-installer, you should use Python 3.9 from the official site. (Python 3.7 doesn't probably work.) When you use a 64-bit version of Vim, you should use a 64-bit version of Python, and when you use a 32-bit version of Vim, you should use a 32-bit version of Python.

If you want to build Vim by yourself, you should specify PYTHON3, PYTHON3_VER, and DYNAMIC_PYTHON3 correctly. See src/INSTALLpc.txt for detail.

ARIT MISTRI

unread,
Aug 25, 2021, 6:01:37 AM8/25/21
to vim/vim, vim-dev ML, Manual

Thank you for the information,
So i set python 3.9 path of my windows system ok,


On Wed, Aug 25, 2021, 11:56 AM K.Takata ***@***.***> wrote:

> (Note that this issue is about python 2.7, not about 3.7.)
> If you use the latest version from vim-win32-installer
> <https://github.com/vim/vim-win32-installer>, you should use Python 3.9
> from the official site <https://www.python.org/downloads/>. (Python 3.7

> doesn't probably work.) When you use a 64-bit version of Vim, you should
> use a 64-bit version of Python, and when you use a 32-bit version of Vim,
> you should use a 32-bit version of Python.
>
> If you want to build Vim by yourself, you should specify PYTHON3,
> PYTHON3_VER, and DYNAMIC_PYTHON3 correctly. See src/INSTALLpc.txt
> <https://github.com/vim/vim/blob/master/src/INSTALLpc.txt> for detail.
>
> —
> You are receiving this because you commented.

> Reply to this email directly, view it on GitHub
> <https://github.com/vim/vim/issues/526#issuecomment-905220837>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ATD6J6QDLWHWZRIZBAYM45TT6SELDANCNFSM4BWPX5GQ>

> .
> Triage notifications on the go with GitHub Mobile for iOS
> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
> or Android
> <https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>
Reply all
Reply to author
Forward
0 new messages