The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Shuyib (21) [Avatar] Offline

I've just purchase the liveVideo. I was trying to move to theano and i'm getting an error. Before i show my error here how my json file looks like

    "floatx": "float32",
    "backend": "theano",
    "image_data_format": "channels_first",
    "epsilon": 1e-07

Then i change the backend to "theano" and image_data_format to "channels_last".

This is the error i'm getting.

/Users/brendamainye/anaconda/envs/py35/lib/python3.5/site-packages/h5py/ FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
Using Theano backend.

You can find the C code in this temporary file: /var/folders/rd/xmt7lsxs4j95cdrp1ddl62v00000gn/T/theano_compilation_error_j055tq63
ImportError Traceback (most recent call last)
~/anaconda/envs/py35/lib/python3.5/site-packages/theano/gof/ in <module>()
74 if version != getattr(lazylinker_ext, '_version', None):
---> 75 raise ImportError()
76 except ImportError:


During handling of the above exception, another exception occurred:
ImportError                               Traceback (most recent call last)
~/anaconda/envs/py35/lib/python3.5/site-packages/theano/gof/ in <module>()
     91             if version != getattr(lazylinker_ext, '_version', None):
---> 92                 raise ImportError()
     93         except ImportError:


During handling of the above exception, another exception occurred:

Exception                                 Traceback (most recent call last)
<ipython-input-1-88d96843a926> in <module>()
----> 1 import keras

~/anaconda/envs/py35/lib/python3.5/site-packages/keras/ in <module>()
      1 from __future__ import absolute_import
----> 3 from . import utils
      4 from . import activations
      5 from . import applications

~/anaconda/envs/py35/lib/python3.5/site-packages/keras/utils/ in <module>()
      4 from . import data_utils
      5 from . import io_utils
----> 6 from . import conv_utils
      8 # Globally-importable utils.

~/anaconda/envs/py35/lib/python3.5/site-packages/keras/utils/ in <module>()
      7 from six.moves import range
      8 import numpy as np
----> 9 from .. import backend as K

~/anaconda/envs/py35/lib/python3.5/site-packages/keras/backend/ in <module>()
     78 elif _BACKEND == 'theano':
     79     sys.stderr.write('Using Theano backend.\n')
---> 80     from .theano_backend import *
     81 elif _BACKEND == 'tensorflow':
     82     sys.stderr.write('Using TensorFlow backend.\n')

~/anaconda/envs/py35/lib/python3.5/site-packages/keras/backend/ in <module>()
      5 from collections import defaultdict
      6 from contextlib import contextmanager
----> 7 import theano
      8 from theano import tensor as T
      9 from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams

~/anaconda/envs/py35/lib/python3.5/site-packages/theano/ in <module>()
    108     object2, utils)
--> 110 from theano.compile import (
    111     SymbolicInput, In,
    112     SymbolicOutput, Out,

~/anaconda/envs/py35/lib/python3.5/site-packages/theano/compile/ in <module>()
     10 from theano.compile.function_module import *
---> 12 from theano.compile.mode import *
     14 from import *

~/anaconda/envs/py35/lib/python3.5/site-packages/theano/compile/ in <module>()
      9 import theano
     10 from theano import gof
---> 11 import theano.gof.vm
     12 from theano import config
     13 from six import string_types

~/anaconda/envs/py35/lib/python3.5/site-packages/theano/gof/ in <module>()
    671     if not theano.config.cxx:
    672         raise theano.gof.cmodule.MissingGXX('lazylinker will not be imported if theano.config.cxx is not set.')
--> 673     from . import lazylinker_c
    675     class CVM(lazylinker_c.CLazyLinker, VM):

~/anaconda/envs/py35/lib/python3.5/site-packages/theano/gof/ in <module>()
    125             args = cmodule.GCC_compiler.compile_args()
    126             cmodule.GCC_compiler.compile_str(dirname, code, location=loc,
--> 127                                              preargs=args)
    128             # Save version into the file.
    129             init_py = os.path.join(loc, '')

~/anaconda/envs/py35/lib/python3.5/site-packages/theano/gof/ in compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs, py_module, hide_symbols)
   2357             # difficult to read.
   2358             raise Exception('Compilation failed (return status=%s): %s' %
-> 2359                             (status, compile_stderr.replace('\n', '. ')))
   2360         elif config.cmodule.compilation_warning and compile_stderr:
   2361             # Print errors just below the command line.

Exception: Compilation failed (return status=1): In file included from /Users/brendamainye/.theano/compiledir_Darwin-15.6.0-x86_64-i386-64bit-i386-3.5.4-64/lazylinker_ext/mod.cpp:1:. In file included from /Users/brendamainye/anaconda/envs/py35/include/python3.5m/Python.h:25:. /Users/brendamainye/anaconda/envs/py35/include/c++/v1/stdio.h:108:15: fatal error: 'stdio.h' file not found. #include_next <stdio.h>.               ^~~~~~~~~. 1 error generated.. 

My Keras version 2.1.3

Please assist me to fix this.
Thanks in advance.
430476 (6) [Avatar] Offline
Hmm, it would seem like there's a version mismatch between Keras and NumPy, or possibly Theano and NumPy. Given that Theano has stopped development since the release of this course, I would recommend switching to TensorFlow as the backend.
Shuyib (21) [Avatar] Offline
Thanks. I'll just stick to TensorFlow. smilie