Pergunta

I'm trying to install Theano on Enthought Python Distribution (EPD), but I am getting a weird error. Here is what my installation looks like:

  • I have installed EPD to C:\Python27.
  • After that, I have installed pip by using easy_install pip
  • I installed Theano by using pip install Theano
  • To test, I start ipython and type import theano. I get the following error:

    Problem occurred during compilation with the command line below:
    g++ -shared -g -IC:\Python27\lib\site-packages\numpy\core\include -IC:\Python27\include -o C:\Users\Ove\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_37_Stepping_5_GenuineIntel-2.7.2\lazylinker_ext\lazylinker_ext.pyd C:\Users\Ove\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_37_Stepping_5_GenuineIntel-2.7.2\lazylinker_ext\mod.cpp -LC:\Python27\libs -LC:\Python27 -lpython27
    C:\Users\Ove\AppData\Local\Temp\ccIoNPlU.o: In function `initlazylinker_ext':C:/Users/Ove/AppData/Local/Theano/compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_37_Stepping_5_GenuineIntel-2.7.2/lazylinker_ext/mod.cpp:911: undefined reference to `__imp_Py_InitModule4'
    collect2: ld returned 1 exit status
    
    Exception: Compilation failed (return status=1): C:\Users\Ove\AppData\Local\Temp. C:/Users/Ove/AppData/Local/Theano/compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_37_Stepping_5_GenuineIntel-2.7.2/lazylinker_ext/mod.cpp:911: undefi. collect2: ld returned 1 exit status4'
    

Does anyone know how to get Theano to run with EPD?

Foi útil?

Solução

The last release of Theano(0.5) has some problem on Windows. You need to install the bleeding edge version. You can update your version like this:

pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git

This should solve the problem. If not, you probably have some conflict with a different installation of gcc. Do you have installed it with cygwin or mingw? EPD installs its own version of mingw.

Outras dicas

I couldn't get Theano working with Enthought, but using the Anaconda python distribution I eventually got it working. Here's how:

  • uninstall Enthought and any other python version (start from scratch)
  • download and install Anaconda python distribution from this link: http://09c8d0b2229f813c1b93-c95ac804525aac4b6dba79b00b39d1d3.r79.cf1.rackcdn.com/Anaconda-1.5.0-Windows-x86_64.exe and click the option to use Anaconda as your default python version
  • to get the academic license, go to this page: https://store.continuum.io/cshop/academicanaconda and click the "free" button next to Anaconda Academic License (right side of page)
  • you should receive an email with an academic license .txt file. Follow the instructions in the email to place the file in the correct directory, and run several command-line commands to update anaconda and install numpy and scipy
  • open a windows command prompt and type

    pip install theano

  • create a file .theanorc.txt containing the lines:

    [global] openmp=False

    [blas] ldflags=

  • place .theanorc.txt in your home folder (the folder for your user account)

  • make sure the following paths are added to your PATH environment variable:

    C:\Anaconda\MinGW\bin; C:\Anaconda\MinGW\x86_64-w64-mingw32\lib; C:\Anaconda; C:\Anaconda\Scripts;

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top