I am trying to setup emacs on a windows 7 machine, and having trouble executing python/ipython code blocks. I am able to send these code blocks to org-edit-special (C-c '), start a python process (C-c C-p), and then execute the code successfully from org-edit-special buffer.

Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] Type 'copyright', 'credits' or 'license' for more information IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]:

If I try to execute the code from the org source code block, I get an error:

Traceback (most recent call last):
  File "c:/Users/user1/.emacs.d/elpa/ob-ipython-20180224.953/client.py", line 1, in <module>
    import jupyter_client as client
  File "c:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\__init__.py", line 4, in <module>
    from .connect import *
  File "c:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\connect.py", line 23, in <module>
    import zmq
  File "c:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\zmq\__init__.py", line 47, in <module>
    from zmq import backend
  File "c:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
  File "c:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
    raise value
  File "c:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
    _ns = select_backend(first)
  File "c:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
    mod = __import__(name, fromlist=public_api)
  File "c:\Users\user1\AppData\Local\Continuum\anaconda3\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
    from . import (constants, error, message, context,
ImportError: DLL load failed: The specified module could not be found.

Here is my conda info

(base) C:\Users\user1>conda info

     active environment : base
    active env location : C:\Users\user1\AppData\Local\Continuum\anacond
            shell level : 1
       user config file : C:\Users\user1\.condarc
 populated config files : C:\Users\user1\.condarc
          conda version : 4.6.12
    conda-build version : 3.17.8
         python version : 3.7.3.final.0
       base environment : C:\Users\user1\AppData\Local\Continuum\anacond
a3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
          package cache : C:\Users\user1\AppData\Local\Continuum\anacond
       envs directories : C:\Users\user1\AppData\Local\Continuum\anacond
               platform : win-64
             user-agent : conda/4.6.12 requests/2.21.0 CPython/3.7.3 Windows/7 W
          administrator : False
             netrc file : None
           offline mode : False

(base) C:\Users\user1>

I used Dependency Walker in


To see if there were missing dependencies causing this error.

Error: At least one required implicit or forwarded dependency was not found.
    Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
    Error: Modules with different CPU types were found.
    Warning: At least one delay-load dependency module was not found.
    Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
 Directory of C:\Users\user1\AppData\Local\Continuum\anaconda3\Lib\site-

04/16/2019  02:25 PM    <DIR>          .
04/16/2019  02:25 PM    <DIR>          ..
02/19/2019  06:38 AM               894 checkrc.pxd
02/25/2019  08:35 PM            68,096 constants.cp37-win_amd64.pyd
02/19/2019  06:38 AM            12,728 constants.pxi
02/19/2019  06:38 AM             6,751 constant_enums.pxi
02/25/2019  08:35 PM            65,024 context.cp37-win_amd64.pyd
02/19/2019  06:38 AM             1,778 context.pxd
02/25/2019  08:35 PM            30,720 error.cp37-win_amd64.pyd
02/19/2019  06:38 AM             4,398 libzmq.pxd
02/25/2019  08:35 PM            86,016 message.cp37-win_amd64.pyd
02/19/2019  06:38 AM             2,398 message.pxd
02/25/2019  08:35 PM           134,656 socket.cp37-win_amd64.pyd
02/19/2019  06:38 AM             2,104 socket.pxd
02/25/2019  08:35 PM            41,472 utils.cp37-win_amd64.pyd
02/25/2019  08:35 PM            51,200 _device.cp37-win_amd64.pyd
02/25/2019  08:35 PM            60,416 _poll.cp37-win_amd64.pyd
02/25/2019  08:35 PM            46,592 _proxy_steerable.cp37-win_amd64.pyd
02/25/2019  08:35 PM            28,672 _version.cp37-win_amd64.pyd
02/19/2019  06:38 AM               731 __init__.py
04/16/2019  02:28 PM    <DIR>          __pycache__
              18 File(s)        644,646 bytes
               3 Dir(s)  24,346,120,192 bytes free

Are these amd64 actually the cause of this? Should I expect different behavior from the source code block execution and the org-edit-special execution?

I tried uninstalling and reinstalling cython to be sure, but this did not change the behavior.

I maybe have the wrong shell interpreter selected?

(require 'org)
(setq python-shell-completion-native-enable nil)
(setq python-shell-interpreter "c:/Users/user1/AppData/Local/Continuum/anaconda3/Scripts/ipython"
      python-shell-interpreter-args "--simple-prompt -i")
  '((ipython . t))) 
  • Looks like an issue with your zmq package. Are you using the same python/ipython with each attempt? What happens with python vs ipython? What happens when you run your code outside Emacs? With a non-Anaconda python.
    – nega
    Apr 19 '19 at 12:57
  • The code block will execute if I use python, but I get an error when I specify ipython. The only python installed on my system is from anaconda. I have ipython specified as the default python-shell. I tried specifying the path explicitly, as above, and also this. (setq python-shell-completion-native-enable nil) (setq python-shell-interpreter "ipython" python-shell-interpreter-args "--simple-prompt -i") I can run the code fine outside of emacs, and execute the same code properly with ipython from a linux machine.
    – debby
    Apr 20 '19 at 6:10
  • Another potential issue, I don't have full admin privileges. Everything is installed in my home directory, but trying to byte compile files for faster load and runtime just produced this Error: Opening directory: Permission denied, c:/Users/Administrator. I don't know if that is interfering in any way, or if there's a good way to test that as I fiddle with setting this up.
    – debby
    Apr 20 '19 at 16:32
  • unless you specifically need ipython's REPL, use python as your interpreter.
    – nega
    Apr 22 '19 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.