1

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
jonrsharpe
123k31 gold badges278 silver badges489 bronze badges
asked Feb 25, 2018 at 22:18

3 Answers 3

1

PROBLEM SOLVED!!

Set parameter in system properties ---> Advanced --->Environment Variables--->System variables--->New..

Variable - MKL_THREADING_LAYER

Value - GNU

Image - Instruction

answered Feb 26, 2018 at 23:19
Sign up to request clarification or add additional context in comments.

Comments

0

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'
answered Feb 25, 2018 at 23:40

1 Comment

Hi, Is the same - '1.0.1'. Thanks in advance.
0

For me it is working by leaving open the anaconda prompt. Before that I have changed the json file to 'KERAS_BACKEND=tensorflow'

answered Apr 3, 2018 at 14:46

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.