title: kaggle could not download resnet50 pretrained model
body: <p>I am trying to use resnet50 pretrained model on Kaggle kernel. </p>
  
  <p>But, when I run the following code, Error occurs and it could not download the pretrained model. How Can I make it work?</p>
  
  <pre><code>from keras.applications.resnet50 import ResNet50
  from keras.preprocessing import image
  from keras.applications.resnet50 import preprocess_input, decode_predictions
  import numpy as np
  
  model = ResNet50(weights='imagenet', include_top=False)
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>-> 1318                           encode_chunked=req.has_header('Transfer-encoding'))    1319<br>
    except OSError as err: # timeout error
    ...   </p>
    
    <p>Exception: URL fetch failure on
    <a href="https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5" rel="nofollow noreferrer">https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5</a>:
    None -- [Errno -2] Name or service not known</p>
  </blockquote>
  
  <p>All logs:</p>
  
  <blockquote>
    <p>Using TensorFlow backend.
    /opt/conda/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning:
    compiletime version 3.5 of module
    'tensorflow.python.framework.fast_tensor_util' does not match runtime
    version 3.6   return f(*args, **kwds)</p>
    
    <p>Downloading data from
    <a href="https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5" rel="nofollow noreferrer">https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5</a></p>
    
    <p>--------------------------------------------------------------------------- gaierror                                  Traceback (most recent call
    last) /opt/conda/lib/python3.6/urllib/request.py in do_open(self,
    http_class, req, **http_conn_args)    1317<br>
    h.request(req.get_method(), req.selector, req.data, headers,
    -> 1318                           encode_chunked=req.has_header('Transfer-encoding'))    1319<br>
    except OSError as err: # timeout error</p>
    
    <p>/opt/conda/lib/python3.6/http/client.py in request(self, method, url,
    body, headers, encode_chunked)    1238         """Send a complete
    request to the server."""
    -> 1239         self._send_request(method, url, body, headers, encode_chunked)    1240 </p>
    
    <p>/opt/conda/lib/python3.6/http/client.py in _send_request(self, method,
    url, body, headers, encode_chunked)    1284             body =
    _encode(body, 'body')
    -> 1285         self.endheaders(body, encode_chunked=encode_chunked)    1286 </p>
    
    <p>/opt/conda/lib/python3.6/http/client.py in endheaders(self,
    message_body, encode_chunked)    1233             raise
    CannotSendHeader()
    -> 1234         self._send_output(message_body, encode_chunked=encode_chunked)    1235 </p>
    
    <p>/opt/conda/lib/python3.6/http/client.py in _send_output(self,
    message_body, encode_chunked)    1025         del self._buffer[:]
    -> 1026         self.send(msg)    1027 </p>
    
    <p>/opt/conda/lib/python3.6/http/client.py in send(self, data)
        963             if self.auto_open:
    --> 964                 self.connect()
        965             else:</p>
    
    <p>/opt/conda/lib/python3.6/http/client.py in connect(self)    1391 
    -> 1392             super().connect()    1393 </p>
    
    <p>/opt/conda/lib/python3.6/http/client.py in connect(self)
        935         self.sock = self._create_connection(
    --> 936             (self.host,self.port), self.timeout, self.source_address)
        937         self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)</p>
    
    <p>/opt/conda/lib/python3.6/socket.py in create_connection(address,
    timeout, source_address)
        703     err = None
    --> 704     for res in getaddrinfo(host, port, 0, SOCK_STREAM):
        705         af, socktype, proto, canonname, sa = res</p>
    
    <p>/opt/conda/lib/python3.6/socket.py in getaddrinfo(host, port, family,
    type, proto, flags)
        744     addrlist = []
    --> 745     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
        746         af, socktype, proto, canonname, sa = res</p>
    
    <p>gaierror: [Errno -2] Name or service not known</p>
    
    <p>During handling of the above exception, another exception occurred:</p>
    
    <p>URLError                                  Traceback (most recent call
    last)
    /opt/conda/lib/python3.6/site-packages/Keras-2.0.6-py3.6.egg/keras/utils/data_utils.py
    in get_file(fname, origin, untar, md5_hash, file_hash, cache_subdir,
    hash_algorithm, extract, archive_format, cache_dir)
        219             try:
    --> 220                 urlretrieve(origin, fpath, dl_progress)
        221             except URLError as e:</p>
    
    <p>/opt/conda/lib/python3.6/urllib/request.py in urlretrieve(url,
    filename, reporthook, data)
        247 
    --> 248     with contextlib.closing(urlopen(url, data)) as fp:
        249         headers = fp.info()</p>
    
    <p>/opt/conda/lib/python3.6/urllib/request.py in urlopen(url, data,
    timeout, cafile, capath, cadefault, context)
        222         opener = _opener
    --> 223     return opener.open(url, data, timeout)
        224 </p>
    
    <p>/opt/conda/lib/python3.6/urllib/request.py in open(self, fullurl,
    data, timeout)
        525 
    --> 526         response = self._open(req, data)
        527 </p>
    
    <p>/opt/conda/lib/python3.6/urllib/request.py in _open(self, req, data)
        543         result = self._call_chain(self.handle_open, protocol, protocol +
    --> 544                                   '_open', req)
        545         if result:</p>
    
    <p>/opt/conda/lib/python3.6/urllib/request.py in _call_chain(self, chain,
    kind, meth_name, *args)
        503             func = getattr(handler, meth_name)
    --> 504             result = func(*args)
        505             if result is not None:</p>
    
    <p>/opt/conda/lib/python3.6/urllib/request.py in https_open(self, req)<br>
    1360             return self.do_open(http.client.HTTPSConnection, req,
    -> 1361                 context=self._context, check_hostname=self._check_hostname)    1362 </p>
    
    <p>/opt/conda/lib/python3.6/urllib/request.py in do_open(self,
    http_class, req, **http_conn_args)    1319             except OSError
    as err: # timeout error
    -> 1320                 raise URLError(err)    1321             r = h.getresponse()</p>
    
    <p>URLError: </p>
    
    <p>During handling of the above exception, another exception occurred:</p>
    
    <p>Exception                                 Traceback (most recent call
    last)  in ()
          4 import numpy as np
          5 
    ----> 6 model = ResNet50(weights='imagenet', include_top=False)</p>
    
    <p>/opt/conda/lib/python3.6/site-packages/Keras-2.0.6-py3.6.egg/keras/applications/resnet50.py in ResNet50(include_top, weights, input_tensor, input_shape, pooling,
    classes)
        261                                     WEIGHTS_PATH_NO_TOP,
        262                                     cache_subdir='models',
    --> 263                                     md5_hash='a268eb855778b3df3c7506639542a6af')
        264         model.load_weights(weights_path)
        265         if K.backend() == 'theano':</p>
    
    <p>/opt/conda/lib/python3.6/site-packages/Keras-2.0.6-py3.6.egg/keras/utils/data_utils.py
    in get_file(fname, origin, untar, md5_hash, file_hash, cache_subdir,
    hash_algorithm, extract, archive_format, cache_dir)
        220                 urlretrieve(origin, fpath, dl_progress)
        221             except URLError as e:
    --> 222                 raise Exception(error_msg.format(origin, e.errno, e.reason))
        223             except HTTPError as e:
        224                 raise Exception(error_msg.format(origin, e.code, e.msg))</p>
    
    <p>Exception: URL fetch failure on
    <a href="https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5" rel="nofollow noreferrer">https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5</a>:
    None -- [Errno -2] Name or service not known</p>
  </blockquote>