parsonsmatt / intero-neovim

A neovim plugin for Intero, forked from ghcmod-vim
218 stars 28 forks source link

Intero Python Module Not Found on Win32 #83

Closed lordmilko closed 7 years ago

lordmilko commented 7 years ago

When attempting to use intero-neovim in Windows, an error is thrown when opening a Haskell file, stating

Error detected while processing function provider#python#Call:
line 18:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named intero

The issue is that python is unable to find the intero module defined in intero.py under the plugin's install directory. Running :py print sys.path confirms that the plugin directory was successfully added to the sys path as expected.

['C:\\Windows\\SYSTEM32\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib',
'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27\\lib\\site-packages',
'_vim_path_', 'C:\\Users\administrator\\AppData\\Local\\nvim\\plugged\\intero-neovim']

However when executing :py import intero you can see with Process Monitor that Python doesn't actually search for the intero module on every folder on the sys.path. Rather, only the following directories are considered

Opening python.exe manually, adding the intero-neovim folder to the sys.path and importing the module successfully works (in that it gives an error it couldn't find the vim module)

Attempting to trick python into finding the intero module by symlinking from one of the directories it tries in gets past this step, however then we fail with other strange errors (which may or may not be due to our attempting to hack the system)

If a virtualenv is used instead of the global python install, python will search in both the virtualenv folder and the global folder, but still not the intero-neovim folder.

Minimal init.vim:

let g:python_host_prog='C:/Python27/python.exe'

call plug#begin('~/AppData/Local/nvim/plugged')

Plug 'parsonsmatt/intero-neovim'
Plug 'neomake/neomake'

call plug#end()
decentral1se commented 7 years ago

We've since added a setup.py, which may (totally guessing!) get the module on the $PATH. @lordmilko, could you try with the latest update? Also, do you see a possible fix for this (just skirting over this one, sorry if I missed something)?

jez commented 7 years ago

This should be fixed now that we no longer have Python (#91).