Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import error under Windows: lazylinker_c.c #2732

Closed
gsmafra opened this issue Apr 4, 2015 · 11 comments
Closed

Import error under Windows: lazylinker_c.c #2732

gsmafra opened this issue Apr 4, 2015 · 11 comments

Comments

@gsmafra
Copy link

gsmafra commented Apr 4, 2015

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 <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/
(...)
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

@ddofer
Copy link

ddofer commented Apr 5, 2015

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

@abergeron
Copy link
Member

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.

@gsmafra
Copy link
Author

gsmafra commented Apr 7, 2015

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")

@abergeron
Copy link
Member

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

@gsmafra
Copy link
Author

gsmafra commented Apr 7, 2015

Too big to paste directly here

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

@abergeron
Copy link
Member

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?)."

@gsmafra
Copy link
Author

gsmafra commented Apr 12, 2015

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?

@gsmafra
Copy link
Author

gsmafra commented Apr 14, 2015

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

@gsmafra gsmafra closed this as completed Apr 14, 2015
@nouiz
Copy link
Member

nouiz commented Apr 15, 2015

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

#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 notifications@github.com wrote:

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


Reply to this email directly or view it on GitHub
#2732 (comment).

@DMU-3dTuneIn
Copy link

For Anaconda user install theano from: conda install theano pygpu

@deaspo
Copy link

deaspo commented Mar 17, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants