Cannot install pylearn2 to WinPython-64bit-3.4.4.1

2019-08-10 05:33发布

问题:

I am trying to install the pylearn2 package (http://deeplearning.net/software/pylearn2/). I do it in the Windows 7(x64) with the WinPython-64bit-3.4.4.1. First there is an error said that :"Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat)". Then I install the VS2012 and configure the environment variables. After I execute "python setup.py develop", there is a new error which is cited as followed:

E:\WinPython-64bit-3.4.4.1\download\pylearn2>python setup.py develop
WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to exe
cute optimized C-implementations (for both CPU and GPU) and will default to Pyth
on implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.E:\WinPython-64bit3.4.4.1\python-3.4.4.amd64\lib\site-packages\setuptools\dist.
py:285: UserWarning: Normalizing '0.1dev' to '0.1.dev0'normalized_version,
running develop
running egg_info
creating pylearn2.egg-info
writing top-level names to pylearn2.egg-info\top_level.txt
writing requirements to pylearn2.egg-info\requires.txt
writing pylearn2.egg-info\PKG-INFO
writing dependency_links to pylearn2.egg-info\dependency_links.txt
writing manifest file 'pylearn2.egg-info\SOURCES.txt'
reading manifest file 'pylearn2.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pylearn2.egg-info\SOURCES.txt'
running build_ext
cythoning pylearn2/utils/_window_flip.pyx to pylearn2/utils\_window_flip.c
building 'pylearn2.utils._window_flip' extension
creating build
creating build\temp.win-amd64-3.4
creating build\temp.win-amd64-3.4\Release
creating build\temp.win-amd64-3.4\Release\pylearn2
creating build\temp.win-amd64-3.4\Release\pylearn2\utils
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IE:\WinPython-64bit-3.4.4.1\python-3.4.4.amd64\lib\site-packages\numpy\core\include -IE:\WinPython-64bit-3.4.4.1\python-3.4.4.amd64\include -IE:\WinPython-64bit-3.4.4.1\python-3.4.4.amd64\include /Tcpylearn2/utils\_window_flip.c /Fobuild\temp.win-amd64-3.4\Release\pylearn2/utils\_window_flip.obj
Found executable C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\cl.exe
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:E:\WinPython-64bit-3.4.4.1\python3.4.4.amd64\libs /LIBPATH:E:\WinPython-64bit-3.4.4.1\python3.4.4.amd64\PCbuild\amd64 
/EXPORT:PyInit__window_flip build\temp.win-amd643.4\Release\pylearn2/utils\_window_flip.obj /OUT:E:\WinPython-64bit-3.4.4.1\download\pylearn2\pylearn2\utils\_window_flip.pyd
/IMPLIB:build\temp.win-amd64-3.4\Release\pylearn2/utils\_window_flip.lib
/MANIFESTFILE:build\temp.win-amd643.4\Release\pylearn2/utils\_window_flip.pyd.manifest
Found executable C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\link.exe
_window_flip.obj : warning LNK4197: export 'PyInit__window_flip' specified multiple times; using first specification
Creating library build\temp.win-amd643.4\Release\pylearn2/utils\_window_flip
.lib and object build\temp.win-amd64-3.4\Release\pylearn2/utils\_window_flip.exp

_window_flip.obj : error LNK2019: unresolved external symbol rand_r referenced in function__pyx_pf_8pylearn2_5utils_12_window_flip_2random_window_and_flip_c01b



**E:\WinPython-64bit-3.4.4.1\download\pylearn2\pylearn2\utils\_window_flip.pyd : fatal error LNK1120: 1 unresolved externals
error: Command "C:\Program Files (x86)\Microsoft Visual Studio12.0\VC\BIN\amd64\link.exe /DLL /nologo /INCREMENTAL:NO      /LIBPATH:E:\WinPython-64bit-3.4.4.1\python-3.4.4.amd64\libs     /LIBPATH:E:\WinPython-64bit-3.4.4.1\python-3.4.4.amd64\PCbuil
d\amd64 /EXPORT:PyInit__window_flip build\temp.win-amd64-3.4\Release\pylearn2/utils\_window_flip.obj /OUT:E:\WinPython-64bit-3.4.4.1\download\pylearn2\pylearn2\
utils\_window_flip.pyd /IMPLIB:build\temp.win-amd64-3.4\Release\pylearn2/utils\_
window_flip.lib /MANIFESTFILE:build\temp.win-amd64-3.4\Release\pylearn2/utils\_w
indow_flip.pyd.manifest"** **failed with exit status 1120**

回答1:

I faced the same problem, in fact a faced a new one, if you want to have a look at it, here it is : Github Issue 1572.

I found a simple workaround.

The steps are as follows:

  1. Download the entire folder from Github (I directly downloaded it, did not clone; will probably make no difference.
  2. Go inside pylearn2-master and find a folder named pylearn.
  3. Copy this and place it in your Lib\Site-packages.

And there you are, you are good to go. :) try : import pylearn2 and see if it works.

Cheers.



回答2:

I got this same error. It is an open issue on github. The fix they recommend worked for me. It involves editing this file: pylearn2-master/pylearn2/utils/_window_flip.pyx and changing line 13 from:

IF UNAME_SYSNAME == "Windows":

to:

IF UNAME_SYSNAME == u"Windows":

Then retry the install.

cb4