I'm trying to import Tensorflow using Spyder, I previously also tried to import Keras and Theano, but there was an error: module "theano" has no attribute "compile" and the import of Tensorflow was alright.
To solve that I installed
conda install tensor
With that I solved the problem with Keras and Theano, but now Tensorflow doesn't import, shows me the follow error:
import tensorflow
Traceback (most recent call last):
File "<ipython-input-9-d6579f534729>", line 1, in <module>
import tensorflow
File "C:\Users\rodmo\Anaconda3\envs\py35\lib\site-
packages\tensorflow\__init__.py", line 50, in <module>
del python
NameError: name 'python' is not defined
3 Answers 3
PROBLEM SOLVED!!
Set parameter in system properties ---> Advanced --->Environment Variables--->System variables--->New..
Variable - MKL_THREADING_LAYER
Value - GNU
Comments
I'd be willing to bet that the "module 'theano' has no attribute 'compile'" would be solved by using a different version of the Theano module. Usually when I get an error like that it's because the code that's importing it depends on a specific version that has subsequently been changed.
For the conda stuff, conda doesn't install to your base python directory, so if your pythonpath is pointing to somewhere else, it may spell trouble. Can you post what version of theano you were running?
In [1]: import theano
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
In [2]: theano.compile?
Type: module
String form: <module 'theano.compile' from '/home/micheal.taylor/.virtualenvs/tensorflow_test/lib/python2.7/site-packages/theano/compile/__init__.pyc'>
File: ~/.virtualenvs/tensorflow_test/lib/python2.7/site-packages/theano/compile/__init__.py
Docstring: <no docstring>
In [3]: theano.__version__
Out[3]: u'1.0.1'
1 Comment
For me it is working by leaving open the anaconda prompt. Before that I have changed the json file to 'KERAS_BACKEND=tensorflow'