Theano: Import error under Windows: lazylinker_c.c

Created on 4 Apr 2015  Â·  11Comments  Â·  Source: Theano/Theano

Hello

I've had the following error when trying to import theano over Windows 7 64 bits, Anaconda, Python 2.7, using Spyder. I installed the library using the pip pull with no problems

The C code seems to be the file lazylinker_c.c

I already installed and succesfully imported theano in another machine with similar configurations and had no problems at all

Obs: I am new to Python

00607 err = PyList_SetItem(self->var_computed_cells[in_idx], 0, zero);
(...)
01075 PyModule_AddObject(m, "CLazyLinker", (PyObject *)&lazylinker_ext_CLazyLinkerType);
01076
01077 return RETVAL;
01078 }
01079
01080
Problem occurred during compilation with the command line below:
g++ -shared -g -D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -IC:\Users\Gustavo\Anaconda\lib\site-packages\numpy\core\include -IC:\Users\Gustavo\Anaconda\include -o C:\Users\Gustavo\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_42_Stepping_7_GenuineIntel-2.7.9-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\Gustavo\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_42_Stepping_7_GenuineIntel-2.7.9-64\lazylinker_ext\mod.cpp -LC:\Users\Gustavo\Anaconda\libs -LC:\Users\Gustavo\Anaconda -lpython27
Traceback (most recent call last):

File "C:\Users\Gustavo\Anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 3049, in run_code
self.showtraceback()

File "C:\Users\Gustavo\Anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 1848, in showtraceback
value, tb, tb_offset=tb_offset)

File "C:\Users\Gustavo\Anaconda\lib\site-packages\IPython\core\ultratb.py", line 1240, in structured_traceback
self, etype, value, tb, tb_offset, number_of_lines_of_context)

File "C:\Users\Gustavo\Anaconda\lib\site-packages\IPython\core\ultratb.py", line 1157, in structured_traceback
self, etype, value, elist, tb_offset, number_of_lines_of_context

File "C:\Users\Gustavo\Anaconda\lib\site-packages\IPython\core\ultratb.py", line 511, in structured_traceback
lines = ''.join(self._format_exception_only(etype, value))

File "C:\Users\Gustavo\Anaconda\lib\site-packages\IPython\core\ultratb.py", line 623, in _format_exception_only
Colors.Normal, s))

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 45: ordinal not in range(128)

Update: g++ was not in my PATH variables, new error now

C:\Users\Gustavo\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_42_Stepping_7_GenuineIntel-2.7.9-64\lazylinker_ext\mod.cpp:1: sorry, unimplemented: 64-bit mode not compiled in
C:\Users\Gustavo\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_42_Stepping_7_GenuineIntel-2.7.9-64\lazylinker_ext\mod.cpp: In function double pytime(const timeval*)': C:\Users\Gustavo\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_42_Stepping_7_GenuineIntel-2.7.9-64\lazylinker_ext\mod.cpp:44: error:gettimeofday' undeclared (first use this function)
C:\Users\Gustavo\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_42_Stepping_7_GenuineIntel-2.7.9-64\lazylinker_ext\mod.cpp:44: error: (Each undeclared identifier is reported only once for each function it appears in.)

Traceback (most recent call last):

File "", line 1, in
import theano

File "C:\Users\Gustavo\Anaconda\lib\site-packages\theano__init__.py", line 55, in
from theano.compile import
File "C:\Users\Gustavo\Anaconda\lib\site-packages\theano\compile__init__.py", line 9, in
from theano.compile.function_module import *

File "C:\Users\Gustavo\Anaconda\lib\site-packages\theano\compile\function_module.py", line 17, in
import theano.compile.mode

File "C:\Users\Gustavo\Anaconda\lib\site-packages\theano\compile\mode.py", line 11, in
import theano.gof.vm

File "C:\Users\Gustavo\Anaconda\lib\site-packages\theano\gof\vm.py", line 569, in
import lazylinker_c

File "C:\Users\Gustavo\Anaconda\lib\site-packages\theano\gof\lazylinker_c.py", line 124, in
preargs=args)

File "C:\Users\Gustavo\Anaconda\lib\site-packages\theano\gof\cmodule.py", line 2009, in compile_str
(status, compile_stderr.replace('\n', '. ')))

. C:\Users\Gustavo\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_42_Stepping_7_GenuineIntel-2.7.9-64\lazylinker_ext\mod.cpp:44: error: (Each undeclared identifier is reported only once for each function it appears in.)ed in

00001 #include
00002 #include "structmember.h"
00003 #include
00004
00005 // Old Python compatibility from here:
00006 // http://www.python.org/dev/peps/pep-0353/
(...)
01075 PyModule_AddObject(m, "CLazyLinker", (PyObject *)&lazylinker_ext_CLazyLinkerType);
01076
01077 return RETVAL;
01078 }
01079
01080
Problem occurred during compilation with the command line below:
C:\Dev-Cpp\bin\g++.exe -shared -g -D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -IC:\Users\Gustavo\Anaconda\lib\site-packages\numpy\core\include -IC:\Users\Gustavo\Anaconda\include -o C:\Users\Gustavo\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_42_Stepping_7_GenuineIntel-2.7.9-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\Gustavo\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_42_Stepping_7_GenuineIntel-2.7.9-64\lazylinker_ext\mod.cpp -LC:\Users\Gustavo\Anaconda\libs -LC:\Users\Gustavo\Anaconda -lpython27

Update 2: I think my compiler was too old, replaced by 4.9.2

I have lots of text in the error but the important part seems to be this one:

Problem occurred during compilation with the command line below:
C:\cygwin64\bin\g++.exe -shared -g -march=corei7 -D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -IC:\Users\Gustavo\Anaconda\lib\site-packages\numpy\core\include -IC:\Users\Gustavo\Anaconda\include -o C:\Users\Gustavo\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_42_Stepping_7_GenuineIntel-2.7.9-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\Gustavo\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_42_Stepping_7_GenuineIntel-2.7.9-64\lazylinker_ext\mod.cpp -LC:\Users\Gustavo\Anaconda\libs -LC:\Users\Gustavo\Anaconda -lpython27

I already tried to do the cxxflags march trick but it doesn't work

Most helpful comment

Solved: installed libpython
http://www.lfd.uci.edu/~gohlke/pythonlibs/

All 11 comments

Same issue/errors.
After printing that out, the error message changes to one involving gof (when I try importing again in the same python session).
Windows 7.1 , 64 Bit, Anaconda. Tried installing bleeding edge Theano as well as (seperately) the pip version.

tuntitled

The cmd screenshot you posted conviniently truncates all error messages after the first two characters, therefore I can't say anything. My guess however is that you have the same error are the OP, which is that the gcc version you installed does not support 64-bits (like the very first error message seems to indicate:

C:\Users\Gustavo\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_42_Stepping_7_GenuineIntel-2.7.9-64\lazylinker_ext\mod.cpp:1: sorry, unimplemented: 64-bit mode not compiled in

Get a build of gcc that supports 64-bit and try again.

Thank you, abergeron, but I had already realized that, see my "Update 2". New message doesn't present anything like that ("sorry, unimplemented: 64-bit mode not compiled")

The Update 2 does not contain the full error output so I can't say anything about it.

Too big to paste directly here

http://m.uploadedit.com/ba3b/1428442797909.txt

The very first error indicates that you have problems with your environnement. Fix those, and if you still have problems with theano then, we'll look at it.

C:\Users\Gustavo\Anaconda\include/pyport.h:886:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
 #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."

I replaced my compiler by the one recommended in the install section
(http://deeplearning.net/software/theano/install_windows.html)

Now I have this

http://m.uploadedit.com/ba3c/1428860353377.txt

I wasn't able to find the "openmp support option" though

Just to be sure, if I don't need CUDA right now then I don't need to follow the "Visual Studio and CUDA" steps in the same install section right?

Solved: installed libpython
http://www.lfd.uci.edu/~gohlke/pythonlibs/

Thanks for the info, this was also needed for anaconda instruction that is
updated there:

https://github.com/Theano/Theano/pull/2764

One error you had was hiding something else. That PR fix that problem too.

On Tue, Apr 14, 2015 at 2:29 PM, gsmafra [email protected] wrote:

Solved: installed libpython
http://www.lfd.uci.edu/~gohlke/pythonlibs/

—
Reply to this email directly or view it on GitHub
https://github.com/Theano/Theano/issues/2732#issuecomment-93009341.

For Anaconda user install theano from: conda install theano pygpu

Followed and installed for Anaconda and now am getting the error: "RuntimeError: To use MKL 2018 with Theano you MUST set "MKL_THREADING_LAYER=GNU" in your environement.". Followed the instruction from here. Didn't solve my problem, so I downgraded to 2017 version, conda install mkl=2017.

Now I can run Theano without problems

Was this page helpful?
0 / 5 - 0 ratings