anaconda python error importing theano

2020-07-10 05:31发布

问题:

I'm quite new in python and of course I'm also new with Theano. I'm trying to use it under windows along with anaconda python. I have installed all the compulsory requirements (except CUDA since on this laptop I don't have a NVIDIA GPU). I installed the same GCC and set the path as suggested in the walkthrough page. Still I get the following error:

    Problem occurred during compilation with the command line below:
C:\TDM-GCC-64\bin\g++.exe -shared -g -march=broadwell -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mmovbe -maes -mno-sha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mbmi2 -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mno-clflushopt -mno-xsavec -mno-xsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-clwb -mno-pcommit --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=broadwell -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\Paolo\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_61_Stepping_4_GenuineIntel-2.7.10-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\Paolo\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_61_Stepping_4_GenuineIntel-2.7.10-64\lazylinker_ext\mod.cpp -LC:\Anaconda\libs -LC:\Anaconda -lpython27
Traceback (most recent call last):
  File "C:/Users/Paolo/PycharmProjects/cvtutorial/tutorial1.py", line 5, in <module>
    import theano
  File "C:\Anaconda\lib\site-packages\theano\__init__.py", line 55, in <module>
    from theano.compile import \
  File "C:\Anaconda\lib\site-packages\theano\compile\__init__.py", line 9, in <module>
    from theano.compile.function_module import *
  File "C:\Anaconda\lib\site-packages\theano\compile\function_module.py", line 18, in <module>
    import theano.compile.mode
  File "C:\Anaconda\lib\site-packages\theano\compile\mode.py", line 11, in <module>
    import theano.gof.vm
  File "C:\Anaconda\lib\site-packages\theano\gof\vm.py", line 568, in <module>
===============================
C:\Anaconda\libs/python27.lib: error adding symbols: File in wrong format
collect2.exe: error: ld returned 1 exit status

    import lazylinker_c
  File "C:\Anaconda\lib\site-packages\theano\gof\lazylinker_c.py", line 116, in <module>
    preargs=args)
  File "C:\Anaconda\lib\site-packages\theano\gof\cmodule.py", line 2010, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
. 

Process finished with exit code 1

Any Suggestions?

This / \ thing in

C:\Anaconda\libs/python27.lib:

sounds weird to me...

回答1:

As suggested by Daniel in a comment, I did not run the command:

conda install mingw libpython

After that I was able to import Theano coerrectly. Solved! :)



回答2:

Have you read this link?

https://github.com/Theano/Theano/issues/2406

Hope you find solution from that.