SolvedTheano Theano Runtime Error - must set MKL_THREADING_LAYER=GNU in environement

I am getting this error when I try to run theano using anaconda and python 2.7.
RuntimeError: To use MKL 2018 with Theano you MUST set "MKL_THREADING_LAYER=GNU" in your environement.

What does this mean. I am running windows 7 and I do not know what term environment means.

Where should I change something?

20 Answers

✔️Accepted Answer

After running into this, the solution is quite easy to do from within Python like this:

import os
os.environ["MKL_THREADING_LAYER"] = "GNU"

Couldn't this be added somewhere in Theano?

Other Answers:

I had this issue too. It seems to be fixed by going to System Properties, Environment variables. Add a New environment variable, and set name to MKL_THREADING_LAYER, and value to GNU. This then allowed to execute import theano from the python shell.


Linux user here, but if you are working inside of a conda virtual environment, it should be noted that you MAY need to perform the step outlined above by @fundmntlTheorem EACH time you enter that environment (this is the case for Linux). For instance, in Linux, I had to write a script to call "export MKL_THREADING_LAYER=GNU" (which sets that environment variable) each time I activate the virtual environment, and a counter script to undo that change upon exiting the environment. Sorry I can't be of more help for Windows.

Running conda install theano==0.9.0 fixed this error for me , of course runing conda remove theano befor