# Windows Issues #20

Closed
opened this Issue Jan 25, 2012 · 28 comments

Projects
None yet

### youngpm commented Jan 25, 2012

 Hi, I've been trying to get GVIM and IPython to play together, without success so far on Windows 7. Here are the steps I've taken: I launch IPython qtconsole successfully. I'm using version 0.12, what came with the EPD Python 2.7.2. :echo has('python') returns 1 for me. I source ipy.vim successfully in vim. Things go bad for me when I attempt to run ":IPython" in vim. I get a "Runtime Error!" alert about "R6034, An application has made an attempt to load the C runtime library incorrectly." VIM reports the following: Traceback (most recent call last): File "", line 1, in File "", line 39, in km_from_string File "C:\Python27\lib\site-packages\IPython\zmq__init__.py", line 39, in check_for_zmq('2.1.4') File "C:\Python27\lib\site-packages\IPython\zmq__init__.py", line 17, in check_for_zmq import zmq File "C:\Python27\lib\site-packages\zmq__init__.py", line 32, in ctypes.cdll.LoadLibrary(libzmq) File "C:\Python27\Lib\ctypes__init__.py", line 431, in LoadLibrary return self.dlltype(name) File "C:\Python27\Lib\ctypes__init_.py", line 353, in init self._handle = _dlopen(self._name, mode) Any idea what my issue is? From IPython i can import ctypes and zmq. I'm pretty new to Python and IPython, which is probably the biggest problem! Thanks for any help! -Patrick
Owner

### ivanov commented Jan 25, 2012

 I get a "Runtime Error!" alert about "R6034, An application has made an attempt to load the C runtime library incorrectly." Perhaps 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 'import os; print os.file' @unpingco successfully got vim-ipython working under windows, but I'm not sure what his setup was.

### youngpm commented Jan 25, 2012

 I think I found the problem, I am pretty sure the version of vim I have was not compiled with the +python libraries. I faked myself out by adding the python.vim to the plugin directory, which is why it was returning 1! Now to get a version compiled with python! I'll let you know if I get it going. Thanks!

### unpingco commented Jan 25, 2012

 You also need to make sure that your VIM matches the Python version you plan to use IPython with. I had to build VIM 7.3 from source to get it for Python version 2.6. Good luck! On Wednesday, January 25, 2012 10:17:45 AM, youngpm wrote: I think I found the problem, I am pretty sure the version of vim I have was not compiled with the +python libraries. I faked myself out by adding the python.vim to the plugin directory, which is why it was returning 1! Now to get a version compiled with python! Reply to this email directly or view it on GitHub: #20 (comment)

### youngpm commented Jan 25, 2012

 Well I reinstalled gvim, and the python libraries are there this time! Not sure that the issue was the first go around. In any case, :include shows +python. This is gvim 7.3.46, which is supposedly compiled with Python 2.7, the flavor I'm using. Checking $vim -c ':py import os; print os.file' -c ':q'$ python -c 'import os; print os.file' Vim says C:\Python27\Lib\os.pyc Python says C:\Python27\lib\os.pyc The case shouldn't matter on Windows right? The actual folder is Lib. I get the same error, Traceback (most recent call last): File "", line 1, in File "", line 39, in km_from_string File "C:\Python27\lib\site-packages\IPython\zmq\__init__.py", line 39, in check_for_zmq('2.1.4') File "C:\Python27\lib\site-packages\IPython\zmq\__init__.py", line 17, in check_for_zmq import zmq File "C:\Python27\lib\site-packages\zmq\__init__.py", line 32, in ctypes.cdll.LoadLibrary(libzmq) File "C:\Python27\Lib\ctypes\__init__.py", line 431, in LoadLibrary return self._dlltype(name) File "C:\Python27\Lib\ctypes\__init__.py", line 353, in __init__ self._handle = _dlopen(self._name, mode) The same as before! Any more thoughts? Thanks!

### unpingco commented Jan 25, 2012

 But, when you go to a plain python interpreter (i.e. c:\python27\python.exe ) and do  >>> import zmq  does it load error-free? Thanks! On Wednesday, January 25, 2012 11:15:52 AM, youngpm wrote: Well I reinstalled gvim, and the python libraries are there this time! Not sure that the issue was the first go around. In any case, :include shows +python. This is gvim 7.3.46, which is supposedly compiled with Python 2.7, the flavor I'm using. Checking $vim -c ':py import os; print os.file' -c ':q'$ python -c 'import os; print os.file' Vim says C:\Python27\Lib\os.pyc Python says C:\Python27\lib\os.pyc The case shouldn't matter on Windows right? The actual folder is Lib. I get the same error, Traceback (most recent call last): File "", line 1, in File "", line 39, in km_from_string File "C:\Python27\lib\site-packages\IPython\zmq\__init__.py", line 39, in check_for_zmq('2.1.4') File "C:\Python27\lib\site-packages\IPython\zmq\__init__.py", line 17, in check_for_zmq import zmq File "C:\Python27\lib\site-packages\zmq\__init__.py", line 32, in ctypes.cdll.LoadLibrary(libzmq) File "C:\Python27\Lib\ctypes\__init__.py", line 431, in LoadLibrary return self._dlltype(name) File "C:\Python27\Lib\ctypes\__init__.py", line 353, in __init__ self._handle = _dlopen(self._name, mode) The same as before! Any more thoughts? Thanks! Reply to this email directly or view it on GitHub: #20 (comment)

### youngpm commented Jan 25, 2012

 Yeah, here is some output:  import zmq zmq.zmq_version() '2.1.11'  Importing ctypes also returns no errors. It is version 1.1.0.

### unpingco commented Jan 25, 2012

 In a Regular console window, do  c:> python -v  and then >>> import zmq  and then watch the trace carefully. It should confess exactly where it is getting the libraries. Ultimately, I think you will need to use DependencyWalker on the PYD or DLLs in ZMQ to find out what's missing. I hope that helps. On Wednesday, January 25, 2012 12:23:56 PM, youngpm wrote: Yeah, here is some output:  import zmq zmq.zmq_version() '2.1.11'  Reply to this email directly or view it on GitHub: #20 (comment)
Owner

### ivanov commented Jan 27, 2012

 @youngpm: you can also take a look at #21 to see if you're running into a similar issue, and if the solution proposed in this pyodbc bug solves it for you

### youngpm commented Feb 6, 2012

 Sorry I've been out of the office on jury duty! In any case, I'm going to try what you suggest. edouardp says "I did this with all of the *.pyd files and now I've got gvim <-> ipython 0.12 interaction going great!" It is unclear to me which *.pyd files he is referring to. Thanks!

### tmdk commented Feb 15, 2012

 I think he is referring to all the *.pyd files in the pyzmq package: zmq\core\constants.pyd zmq\core\context.pyd zmq\core\device.pyd zmq\core\error.pyd zmq\core\message.pyd zmq\core\poll.pyd zmq\core\socket.pyd zmq\core\stopwatch.pyd zmq\core\version.pyd zmq\devices\monitoredqueue.pyd zmq\utils\initthreads.pyd zmq\utils\rebuffer.pyd I had the same problem as in #21 and applying the fix referred by edouardp to these files fixed it for me! HTH

### quasarj commented May 30, 2012

 I still get the error the first time I type :IPython, but everything seems to function right after that, so I can confirm this still works!

### johndgiese commented Jun 20, 2012

 I have been trying to get this to work for a few days now; I am having the exact same problems. A pop-up says: Runtime Error! Program: C:\opt\vim\vim73\gvim.exe R6034 An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information. I check the versions of python in vim, and it is correct. I also checked that the python_path is the same. I am trying to follow the instructions in here, but haven't gotten it to work yet. I am on windows 64bit, Python 2.7.3 newest version of vim (7.3. something) IPython 0.12

### danbe commented Jun 21, 2012

 I never got a popup, just an import error, pyzmq version not ok, import error, initthreads import error etc. Maybe you have a different error, Did you run the dependencywalker on the dlls to see if anything is missing, and then try to fix the manifest with mt? It works very nicely for me now.

### quasarj commented Jun 21, 2012

 I was getting the exact behavior johndgiese is seeing - with the popup error. Running mt as explained above on all of the pyd files fixed it for me. Note that some of my files didn't match the exact ones from the pydoc thread, i had to run it on ALL the pyd files in the pyzmq directory.

### shelper commented Jul 26, 2012

 after i run all the mt commands, the pop up window is still there with error R6034 and zmq import error in vim output when i put :IPython first time, but when i put second time, then it seems the vim is communicating with ipython but ipython does not fire output, say, i run :py run_command('a=1234') and there is nothing happend in ipython, but when i type print a in ipython console, the a is 1234. run enviroment: python 2.7.2, ipython 0.12.1, any one has any idea?

### johndgiese commented Jul 26, 2012

 When you run a command in vim-ipython it sends the command to the ipython server; this is a separate process than the python that vim has internally for scripting; the namespaces are completely separate. Running :py commands will always run in vim's python process, while writing commands in the ipython console will send the command via zmq to the ipython process you started yourself, it will then execute the command, and send the output back to vim via zmq, at which point vim will update the vim-ipython prompt.

### shelper commented Jul 26, 2012

 thanks for explaining, after reading your comments several times, i think i got some idea, so, here is the problem i encounter: 1 start ipython qtconsole 2. start gvim, open foo.py file (which only has lines: 'a= 1234; print a') 3 run :IPython in vim, window pop up giving runtime library loading error R6034, 4. run :IPython again in vim, no error shows up 5. press F5 in vim, the minibuffer shows: In[1]: In[]: run -i 'Path\to\foo.py' press enter or type command to continue 6. switch to ipython qtconsole,found no output, but type a, it prints 1234, which means a is there with value from foo.py So, i know vim and ipython are talking to each other, but this is not so useful if i can not get output from ipython.. and also the error R 6034 shows the first time ? actually if i skip step 4 above, the phenomena is the same... i just wonder if there is a solution to this... thanks again! P.S. in step 5, the number '1' in the 'In[1]' matches the prompt in ipython, that means if you run several command in ipython qtconsole, and then run a script in vim by F5, the number will change to current ipython input prompt number

### johndgiese commented Jul 26, 2012

 This is a bit complicated, but basically there is an ipython kernel, and the console (and vim) are clients that talk to the kernel. Currently the output resulting from commands from one client (e.g. vim) are not displayed in other clients (the IPython kernel). I actually have my own version of vim-ipython that I have heavily modified from ivanov's. If you want to give it a try you can. I am setting up a repository for you, in case you want to.

### shelper commented Jul 26, 2012

 i actually saw the same issue here: ipython/ipython#1873 did you really solve the problem? that would be nice and greatly appreciated if you can share your script, i am working on windows 7 btw, thx

### johndgiese commented Jul 26, 2012

 I created a repository here: https://github.com/johndgiese/vipy/blob/master/README.md On Thu, Jul 26, 2012 at 3:12 PM, shelper < reply@reply.github.com wrote: i actually saw the same issue here: ipython/ipython#1873 did you really solve the problem? that would be nice and greatly appreciated if you can share your script, i am working on windows 7 btw, thx Reply to this email directly or view it on GitHub: #20 (comment)

### shelper commented Jul 26, 2012

 thanks alot! will try it out btw, according to ipython dev person ipython 0.14 should fix the no-output issue. do you notice this when using ipython 0.14? i could not find a place to download this version..

### johndgiese commented Jul 27, 2012

 I am not 100% sure, but I was using 0.14 and it didn't work for me either. That being said I have made a lot of changes to the plugin, so I can not say what the original vim-ipython would do. On Thu, Jul 26, 2012 at 5:39 PM, shelper < reply@reply.github.com wrote: thanks alot! will try it out btw, according to ipython dev person ipython 0.14 should fix the no-output issue. do you notice this when using ipython 0.14? i could not find a place to download this version.. Reply to this email directly or view it on GitHub: #20 (comment)

### LeszekSwirski commented Oct 11, 2012

 I still get the R6034 error, even after running the above mt script, but this time not on zmq but IPython itself, e.g. when running :py import IPython 

### LeszekSwirski commented Oct 16, 2012

 Turns out I was having issues with import uuid. I've now fixed this by merging my python manifest into my vim/gvim's manifest, like so: mt -inputresource:C:\windows\syswow64\python27.dll;#2 -out:%TEMP%\python.manifest mt -inputresource:"C:\Program Files (x86)\vim\vim73\gvim.exe" -out:%TEMP%\gvim.manifest mt -manifest %TEMP%\python.manifest %TEMP%\gvim.manifest -outputresource:"C:\Program Files (x86)\vim\vim73\gvim.exe" mt -manifest %TEMP%\python.manifest -outputresource:"C:\Program Files (x86)\vim\vim73\vim.exe"  (The above is from memory, make sure to backup your vim/gvim first)

### vakosel commented Dec 8, 2012

 Hi all, i had exactly the same issues . My environment is win7 , python27 , pyzmq 2.2.0.1 , ipython 13.1 .Gvim 7.3.754 build with gcc 4.6.2 and python27 I resolved them following these steps after testing with Dep.Walker that there were errors with MSVCR90.DLL loading when opened *.PYD and *.DLL (1) files from pyzmq foder. went to the folder pyzmq with VS command line tools 2012 x86 (my os) and searched for all pyd files. i went to every subfolder where these .pyd existed and executed: mt.exe -inputresource:c:\windows\system32\python27.dll;#2 -outputresource:(XXX).pyd;#2 where (XXX) was every pyd (around 10) in every subfolder..The console didn't show any mistake in the procedure 3) i did the same with the .dll file AND VOILA! Everything is working like charm! I must confess that DANBE'S POST above was the real key ... I just wanted to post this in order to assure that this works.. 👍
Owner

### ivanov commented Mar 26, 2013

 closing this issue

Closed

### accuya commented Apr 27, 2014

 I came across this problem yesterday. XP + python27 + vim7.3 (+python) I fixed it by executing mt.exe -inputresource:"d:\Python27\python.exe" -outputresource:"d:\Program Files\Vim\vim73\gvim.exe" This command actually replaced the manifest embedded in gvim.exe with the one in python.exe. But it DO fix the R6034 error when executing IPython command in gvim. Hope this helps.

Closed

Closed