Theano: Import Error

Created on 26 Feb 2018  Â·  18Comments  Â·  Source: Theano/Theano

I would greatly appreciate if you could let me how to resolve the following error while importing theano, which is installed on windows 10 using anaconda.

C:\Users\Markazi.co\Anaconda3\python.exe "D:/mifs-master_2/MU/learning-from-imbalanced-classes-master/learning-from-imbalanced-classes-master/continuous/Imbalanced - Copy - Copy.py"

Traceback (most recent call last):
You can find the C code in this temporary file: C:\Users\Markazi.co\AppData\Local\Temp\theano_compilation_error_uvinxn23
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 75, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 92, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:/mifs-master_2/MU/learning-from-imbalanced-classes-master/learning-from-imbalanced-classes-master/continuous/Imbalanced - Copy - Copy.py", line 19, in <module>
    import theano.tensor as T
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\__init__.py", line 110, in <module>
    from theano.compile import (
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\compile\__init__.py", line 12, in <module>
    from theano.compile.mode import *
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\compile\mode.py", line 11, in <module>
    import theano.gof.vm
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\gof\vm.py", line 673, in <module>
    from . import lazylinker_c
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 127, in <module>
    preargs=args)
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 2359, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
. 

Best regards,

Most helpful comment

I have the exact same error with you on windows and anaconda. And it works well after the following command:

conda install mingw libpython

All 18 comments

I'm not sure what can help you. Can you remove the python file to not contain space? We didn't test that case and on windows, space handing can be difficult.

Maybe this won't fix the problem, but it could give a better error message.

Which version of Theano you use? Make sure to use 1.0.1

Hi
Thanks.
Sorry, I don't know what you mean by removing the python file to not contain space.
However, I installed Theano 1.01.
Best regards,

@nouiz Hi
Sorry my error is similar to this but it fixed here on Linux.

Best regards,

Can you delete your Theano cache? If that do not fix it, can you try this https://github.com/Theano/Theano/pull/6575 that give a better error message? You can manually copy the only changed file.

Also, you probably have a file with more detail on the error message. Check the full output, it should have the path to that file.

Thanks a lot. Could you please let me know how to delete my Theano cache?
I posted my error completely. This error is also reported here
https://stackoverflow.com/questions/41146147/can-not-import-theano-after-installation-windows-10
and here
https://stackoverflow.com/questions/37279948/run-theano-on-python-3-5

You have this line:

PermissionError: [WinError 32] The process cannot access the file
because it is being used by another process:
'C:\Users\cturn\AppData\Local\Temp\try_march_3v6ffkv9.exe'

Can you reboot? At least, stop all Python process?

On Mon, Mar 12, 2018 at 11:09 AM shahlaebrahimi notifications@github.com
wrote:

Thanks a lot. Could you please let me know how to delete my Theano cache?
I posted my error completely. This error is also reported here

https://stackoverflow.com/questions/41146147/can-not-import-theano-after-installation-windows-10
and here
https://stackoverflow.com/questions/37279948/run-theano-on-python-3-5

—
You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/Theano/Theano/issues/6567#issuecomment-372343495, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AALC-81Eq6fmO9b7HgqIm4kLWMwt6zMgks5tdo-3gaJpZM4STkgr
.

Also, the error message are not the same in this issue and in stack
overflow.

On Mon, Mar 12, 2018 at 11:15 AM Frédéric Bastien <
[email protected]> wrote:

You have this line:

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\cturn\AppData\Local\Temp\try_march_3v6ffkv9.exe'

Can you reboot? At least, stop all Python process?

On Mon, Mar 12, 2018 at 11:09 AM shahlaebrahimi notifications@github.com
wrote:

Thanks a lot. Could you please let me know how to delete my Theano cache?
I posted my error completely. This error is also reported here

https://stackoverflow.com/questions/41146147/can-not-import-theano-after-installation-windows-10
and here
https://stackoverflow.com/questions/37279948/run-theano-on-python-3-5

—
You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/Theano/Theano/issues/6567#issuecomment-372343495,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AALC-81Eq6fmO9b7HgqIm4kLWMwt6zMgks5tdo-3gaJpZM4STkgr
.

@nouiz Sorry, I stopped all process. Then, I just run:
import theano.tensor as T

Error:

C:\Users\Markazi.co\Anaconda3\python.exe D:/mifs-master_2/MU/learning-from-imbalanced-classes-master/learning-from-imbalanced-classes-master/continuous/svc.py
Traceback (most recent call last):

  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 75, in <module>
You can find the C code in this temporary file: C:\Users\Markazi.co\AppData\Local\Temp\theano_compilation_error_d23m74lm
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 92, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:/mifs-master_2/MU/learning-from-imbalanced-classes-master/learning-from-imbalanced-classes-master/continuous/svc.py", line 1, in <module>
    import theano.tensor as T
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\__init__.py", line 110, in <module>
    from theano.compile import (
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\compile\__init__.py", line 12, in <module>
    from theano.compile.mode import *
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\compile\mode.py", line 11, in <module>
    import theano.gof.vm
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\gof\vm.py", line 673, in <module>
    from . import lazylinker_c
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 127, in <module>
    preargs=args)
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 2359, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
. 

Process finished with exit code 1

@nouiz Hi
According to this post, there is a problem with the newer version of MinGW:
My MinGw:
C:\Program Files\mingw-w64\x86_64-6.2.0-posix-seh-rt_v5-rev1\mingw64
Is the error due to it?

You can find the C code in this temporary file: C:\Users\Markazi.co\AppData\Local\Temp\theano_compilation_error__q6g2bid
Traceback (most recent call last):
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 75, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 92, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:/mifs-master_2/MU/learning-from-imbalanced-classes-master/learning-from-imbalanced-classes-master/continuous/logit-plot1.py", line 1, in <module>
    import theano.tensor as T
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\__init__.py", line 110, in <module>
    from theano.compile import (
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\compile\__init__.py", line 12, in <module>
    from theano.compile.mode import *
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\compile\mode.py", line 11, in <module>
    import theano.gof.vm
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\gof\vm.py", line 673, in <module>
    from . import lazylinker_c
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 127, in <module>
    preargs=args)
  File "C:\Users\Markazi.co\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 2359, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
. 

Process finished with exit code 1

Thanks in advance.
Best regards,

The first line of the error message is:

You can find the C code in this temporary file: C:\Users\Markazi.co\AppData\Local\Temp\theano_compilation_error__q6g2bid

Can you send this file?

@nouiz I sent the requested file to the gmail, which is posted on this page. I also sent them to: [email protected]
Thanks a lot.
Best regard,

I have basically the same error message. I am also using Windows 10 and Anaconda.

Traceback (most recent call last):
You can find the C code in this temporary file: c:\users\christ~1\appdata\local\temp\theano_compilation_error_rzrplc
  File "C:/Users/Christine/PycharmProjects/eeg_test/main.py", line 2, in <module>
    import eeglearn.eeg_cnn_lib as eeglib
  File "C:\Users\Christine\Documents\GitHub\EEGLearn\eeglearn\eeg_cnn_lib.py", line 10, in <module>
    import theano
  File "C:\Users\Christine\.conda\envs\eeg_test\lib\site-packages\theano\__init__.py", line 110, in <module>
    from theano.compile import (
  File "C:\Users\Christine\.conda\envs\eeg_test\lib\site-packages\theano\compile\__init__.py", line 12, in <module>
    from theano.compile.mode import *
  File "C:\Users\Christine\.conda\envs\eeg_test\lib\site-packages\theano\compile\mode.py", line 11, in <module>
    import theano.gof.vm
  File "C:\Users\Christine\.conda\envs\eeg_test\lib\site-packages\theano\gof\vm.py", line 673, in <module>
    from . import lazylinker_c
  File "C:\Users\Christine\.conda\envs\eeg_test\lib\site-packages\theano\gof\lazylinker_c.py", line 127, in <module>
    preargs=args)
  File "C:\Users\Christine\.conda\envs\eeg_test\lib\site-packages\theano\gof\cmodule.py", line 2359, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
. 

Process finished with exit code 1

Thanks

@maciejkos Sorry, have you tried these?
http://simranmetric.com/installing-theano-on-windows-10-python-3-5/
https://hsaghir.github.io/data_science/theano-on-windows/
http://ankivil.com/installing-keras-theano-and-dependencies-on-windows-10-python-34/
The second and third link respectively are for python 2.7 and python 3.4 but I couldn't find how to do it for python 3.5.
Thanks in advance.

Might be off topic but I've had issues with the Anaconda Python distribution.... specifically about the bytecode not compiling correctly every time I first initialize the CPython... completely bizarre but nonetheless I noted that in the linked site @shahlaebrahimi posted, they used MiniConda.

:)

I have the exact same error with you on windows and anaconda. And it works well after the following command:

conda install mingw libpython

conda install mingw libpython

Installing mingw and libpython also worked for me to solve the problem on a Windows 10 machine running Theano in a conda virtual environment.

Hey I tried to build an app(dependency: Theano) using cx_freeze, but getting the same error as the question. But it works fine when i run it in IDLE (import theano), and throws error in exe form.
Any HELP!!

Was this page helpful?
0 / 5 - 0 ratings