ImportError occurs in gvim while no errors occur in regular python shell #10

Closed
kongya opened this Issue Oct 3, 2011 · 8 comments

Comments

Projects
None yet
2 participants

kongya commented Oct 3, 2011

My platform is WIN7. I have installed pyzmq-2.1.9,and “import zmq” is right in python and ipython shell, but when i use gvim “:IPythonClipboard” an error occures:”Import error:IPython.zmq requires pyzmq >2.1.4″.In fact, in gvim I type ":py import zmq", "Import Error:DLL load failed special module can not be found" occurs in the line"from zmq.utils import initthreads".In addition,in gvim when i type ":py import nose" etc,it's right.I don't know why.

Owner

ivanov commented Oct 3, 2011

As stated in the README, I suspect that either:

  1. your sys.path in vim differs from the sys.path in regular python. Try running these two lines, and comparing their output files:
$ vim -c 'py import vim, sys; vim.current.buffer.append(sys.path)' -c ':wq vim_syspath'
$ python -c "import sys; f=file('python_syspath','w'); f.write('\n'.join(sys.path)); f.close()"

or
2. your vim is compiled against a different python than you are launching. See if there's a difference between

$ vim -c ':py import os; print os.__file__' -c ':q'
$ python -c ':py import os; print os.__file__'

kongya commented Oct 6, 2011

1.sys.path in vim is same with the sys.path in regular python. 2.both the output is "D:\Program Files\Python27\Lib\os.pyc"

In fact, ":py import zmq" this command can find zmq module, error occurs in the line "from zmq.utils import initthreads" of init.py,so initthreads.pyd can not be loaded.Then I find in the directory "..../zmq/utils/" open a regular python shell "import initthreads" works but in gvim that does not.I am a newer and not aware of the mechanism of the command ":python" of gvim.

Owner

ivanov commented Oct 6, 2011

I see - this sounds similar to this issue in pyzmq: zeromq/pyzmq#80 - can you try out the solution proposed there (adding the location of zmq to your $PATH and not running code from the source directory?

kongya commented Oct 8, 2011

That does not work and I don't think that issue is similar to mine. I can use pyzmq in python shell and run its examples just vim's ":py" command works not well with zmq.
Thanks very much and sorry to bother you.

Owner

ivanov commented Oct 8, 2011

strange - do all of the tests pass for zmq in normal python? I'm clutching at straws - but it seems to be pyzmq-related issue - perhaps try to follow up there, or on the ipython mailing list? Sorry I'm not much help

Owner

ivanov commented Oct 10, 2011

i'm going to go ahead and close this, since it appears to be an issue with the pyzmq installation. Hope you get this sorted out.

@ivanov ivanov closed this Oct 10, 2011

Owner

ivanov commented Jan 27, 2012

@p-gao - can you take a look at #21? it looks like the reporter there was able to resolve a similar issue using the instructions in resolving this issue in pyodbc: http://code.google.com/p/pyodbc/issues/detail?id=214

kongya commented Nov 21, 2012

Yes,that works.Great thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment