Raise Exception(error_msg.format(origin, e.code, e.msg)) Exception: URL fetch failure

Hi guys
Do you know that How can I fix this error in Visual Studio code?

Downloading data from https://storage.googleapis.com/tensorflow/keras-applications/vgg19/vgg19_weights_tf_dim_ordering_tf_kernels_notop.h5
Traceback (most recent call last):
File “C:\Users\mandish\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\utils\data_utils.py”, line 347, in get_file
urlretrieve(origin, fpath, DLProgbar())
File “C:\Users\mandish\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\utils\data_utils.py”, line 85, in urlretrieve
response = urlopen(url, data)
^^^^^^^^^^^^^^^^^^
File “C:\Users\mandish\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py”, line 216, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\mandish\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py”, line 525, in open
response = meth(req, response)
^^^^^^^^^^^^^^^^^^^
File “C:\Users\mandish\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py”, line 634, in http_response
response = self.parent.error(
^^^^^^^^^^^^^^^^^^
File “C:\Users\mandish\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py”, line 563, in error
return self._call_chain(*args)
^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\mandish\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py”, line 496, in _call_chain
result = func(*args)
^^^^^^^^^^^
File “C:\Users\mandish\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py”, line 643, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “c:\Users\mandish\Desktop\Master Thesis-Bita Jamshidi\Coding\CNN(VGG19) Optimized\VGG19 & Transfer Learning Optimized.py”, line 124, in
base_model = VGG19(
^^^^^^
File “C:\Users\mandish\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\applications\vgg19.py”, line 250, in VGG19
weights_path = data_utils.get_file(
^^^^^^^^^^^^^^^^^^^^
File “C:\Users\mandish\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\utils\data_utils.py”, line 349, in get_file
raise Exception(error_msg.format(origin, e.code, e.msg))
Exception: URL fetch failure on https://storage.googleapis.com/tensorflow/keras-applications/vgg19/vgg19_weights_tf_dim_ordering_tf_kernels_notop.h5: 403 – Forbidden

[Done] exited with code=1 in 280.633 seconds

It looks like the specific HTTP error you’re getting is “403 - Forbidden”, which means the server understood the request but refuses to authorize it. If that is the case, your code is fine, it means there’s something else going on. Could be use of a VPN or corporate firewall depending on where you were when you made the request. It could also be possible that keras and/or tensor flow need to be updated.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.