Franck Dernoncourt
Franck Dernoncourt

Reputation: 83357

Using Theano on Windows: missing lazylinker_ext.pyd

When running a Python script that contain import theano, I get this error:

===============================
00001   #include <Python.h>
00002   #include "structmember.h"
00003   #include <sys/time.h>
00004   
00005   // Old Python compatibility from here:
00006   // http://www.python.org/dev/peps/pep-0353/
[...]
01077       return RETVAL;
01078   }
01079   
01080   
Problem occurred during compilation with the command line below:
C:\programming\cpp\gcc-4.9.2-tdm-1-core\bin\g++.exe -shared -g -D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -IC:\Anaconda\lib\site-packages\numpy\core\include -IC:\Anaconda\include -o C:\Users\Francky\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_58_Stepping_9_GenuineIntel-2.7.10-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\Francky\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_58_Stepping_9_GenuineIntel-2.7.10-64\lazylinker_ext\mod.cpp -LC:\Anaconda\libs -LC:\Anaconda -lpython27
===============================
g++.exe: error: CreateProcess: No such file or directory

Traceback (most recent call last):
  File "C:\Users\Francky\Documents\GitHub\nlp\6864project\code\theano\eval_dialog_cat.py", line 7, in <module>
    import theano 
  File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\__init__.py", line 55, in <module>
    from theano.compile import \
  File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\compile\__init__.py", line 9, in <module>
    from theano.compile.function_module import *
  File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\compile\function_module.py", line 18, in <module>
    import theano.compile.mode
  File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\compile\mode.py", line 11, in <module>
    import theano.gof.vm
  File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\gof\vm.py", line 568, in <module>
    import lazylinker_c
  File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\gof\lazylinker_c.py", line 116, in <module>
    preargs=args)
  File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\gof\cmodule.py", line 2010, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
. ception: Compilation failed (return status=1): g++.exe: error: CreateProcess: No such file or directory

It looks like g++.exe: error: CreateProcess: No such file or directory is caused by the absence of the file C:\Users\Francky\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_58_Stepping_9_GenuineIntel-2.7.10-64\lazylinker_ext\lazylinker_ext.pyd. How am I supposed to get this file?


I have installed Theano in Anaconda Python 2.7.10 X64 as follows:

conda install mingw libpython
pip install theano

Then I changed the g++ compiler namely TDM-GCC MinGW Compiler so that it compiles to x64 (otherwise I get C:\Users\Francky\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_58_Stepping_9_GenuineIntel-2.7.10-64\lazylinker_ext\mod.cpp:1: sorry, unimplemented: 64-bit mode not compiled in).

Upvotes: 1

Views: 1607

Answers (2)

Victor Perotti
Victor Perotti

Reputation: 11

I've spent a couple of days on this. Ultimately I had to update theano AFTER changing my G++ compiler to 64 bit (I used http://mingw-w64.org/doku.php). Windows "where" command makes it easy to see where the g++ is installed: where g++ gave me several locations including the 32bit version.

Upvotes: 1

Daniel Renshaw
Daniel Renshaw

Reputation: 34187

From here.

Have you closed your Command window and opened a new one? Changes to your environment variables (via the standard Windows dialogue window) will not apply to open Command windows (you could set the variables separately and manually in an open Command window though).

If setting environment variables doesn't help, the other answers to the linked question may help.

Upvotes: 1

Related Questions