Downloading train-images-idx3-ubyte.gz ...
Traceback (most recent call last):
File "/Users/takumi/github/deep-learning-from-scratch/ch03/neuralnet_mnist.py", line 35, in <module>
x, t = get_data()
^^^^^^^^^^
File "/Users/takumi/github/deep-learning-from-scratch/ch03/neuralnet_mnist.py", line 11, in get_data
(x_train, t_train), (x_test, t_test) = load_mnist(normalize=True, flatten=True, one_hot_label=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/takumi/github/deep-learning-from-scratch/ch03/../dataset/mnist.py", line 111, in load_mnist
init_mnist()
File "/Users/takumi/github/deep-learning-from-scratch/ch03/../dataset/mnist.py", line 80, in init_mnist
download_mnist()
File "/Users/takumi/github/deep-learning-from-scratch/ch03/../dataset/mnist.py", line 47, in download_mnist
_download(v)
File "/Users/takumi/github/deep-learning-from-scratch/ch03/../dataset/mnist.py", line 40, in _download
response = urllib.request.urlopen(request).read()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 215, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 521, in open
response = meth(req, response)
^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 630, in http_response
response = self.parent.error(
^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 559, in error
return self._call_chain(*args)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 492, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 639, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
実行環境
問題の事象
ch03/neuralnet_mnist.pyを実行したところ、以下のように
urllib.error.HTTPError: HTTP Error 403: Forbidden
というエラーが発生し、MNISTデータをダウンロードできない。 また、ブラウザからダウンロード先のリンクへアクセスしても403 Forbiddenとなっている。解決方法
解決にあたって参考にしたもの
@koki0702 お手数おかけしますが修正お願いいたします。