Again HTTP Error 403: Forbidden MNIST

111478: <p>I have already read, that there was the same problem a year ago. It seemed, the problem was fixed, but now it appeared again. What should I do?</p>
<p>import torchvision.datasets<br>
MNIST_train = torchvision.datasets.MNIST(’./’, download=True, train = True)<br>
MNIST_test = torchvision.datasets.MNIST(’./’, download=True, train = False)</p>
<p>Tried also to make headers and use urllib, but still doesn’t work<br>
Thanks for attention!</p>

ptrblck: <p>This should be already fixed in the master branch and should show up in the nightly binary as explained <a href="https://discuss.pytorch.org/t/iam-not-able-to-download-dataset-from-torchvision/113643/2">here</a>.</p>

111478: <p>Thanks a lot for a quick answer. Using your link I solved the problem</p>

dandv: <p>Is this error the same as what was reported on GitHub?</p>
<aside class="onebox githubissue" data-onebox-src="https://github.com/pytorch/vision/issues/1938#issuecomment-2127967636">
  <header class="source">

      <a href="https://github.com/pytorch/vision/issues/1938#issuecomment-2127967636" target="_blank" rel="noopener nofollow ugc">github.com/pytorch/vision</a>
  </header>

  <article class="onebox-body">
    <div class="github-row">
  <div class="github-icon-container" title="Issue">
	  <svg width="60" height="60" class="github-icon" viewBox="0 0 14 16" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg>
  </div>

  <div class="github-info-container">
    <h4>
      <a href="https://github.com/pytorch/vision/issues/1938#issuecomment-2127967636" target="_blank" rel="noopener nofollow ugc">Downloading MNIST dataset with torchvision gives HTTP Error 403</a>
    </h4>

    <div class="github-info">
      <div class="date">
        opened <span class="discourse-local-date" data-format="ll" data-date="2020-03-04" data-time="10:36:34" data-timezone="UTC">10:36AM - 04 Mar 20 UTC</span>
      </div>

        <div class="date">
          closed <span class="discourse-local-date" data-format="ll" data-date="2020-03-05" data-time="16:51:21" data-timezone="UTC">04:51PM - 05 Mar 20 UTC</span>
        </div>

      <div class="user">
        <a href="https://github.com/Borda" target="_blank" rel="noopener nofollow ugc">
          <img alt="Borda" src="https://avatars.githubusercontent.com/u/6035284?v=4" class="onebox-avatar-inline" width="20" height="20">
          Borda
        </a>
      </div>
    </div>

    <div class="labels">
        <span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;">
          bug
        </span>
        <span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;">
          help wanted
        </span>
        <span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;">
          module: datasets
        </span>
    </div>
  </div>
</div>

  <div class="github-row">
    <p class="github-body-container">## 🐛 Bug

I'm getting a 403 error when I try to download MNIST dataset with `t<span class="show-more-container"><a href="" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden">orchvision` 0.4.2.

## To Reproduce

```
../.local/lib/python3.6/site-packages/torchvision/datasets/mnist.py:68: in __init__
    self.download()
../.local/lib/python3.6/site-packages/torchvision/datasets/mnist.py:135: in download
    download_and_extract_archive(url, download_root=self.raw_folder, filename=filename)
../.local/lib/python3.6/site-packages/torchvision/datasets/utils.py:248: in download_and_extract_archive
    download_url(url, download_root, filename, md5)
../.local/lib/python3.6/site-packages/torchvision/datasets/utils.py:96: in download_url
    raise e
../.local/lib/python3.6/site-packages/torchvision/datasets/utils.py:84: in download_url
    reporthook=gen_bar_updater()
/usr/local/lib/python3.6/urllib/request.py:248: in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
/usr/local/lib/python3.6/urllib/request.py:223: in urlopen
    return opener.open(url, data, timeout)
/usr/local/lib/python3.6/urllib/request.py:532: in open
    response = meth(req, response)
/usr/local/lib/python3.6/urllib/request.py:642: in http_response
    'http', request, response, code, msg, hdrs)
/usr/local/lib/python3.6/urllib/request.py:570: in error
    return self._call_chain(*args)
/usr/local/lib/python3.6/urllib/request.py:504: in _call_chain
    result = func(*args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = &lt;urllib.request.HTTPDefaultErrorHandler object at 0x7efbf9edaac8&gt;
req = &lt;urllib.request.Request object at 0x7efbf9eda8d0&gt;
fp = &lt;http.client.HTTPResponse object at 0x7efbf9edaf98&gt;, code = 403
msg = 'Forbidden', hdrs = &lt;http.client.HTTPMessage object at 0x7efbf9ea22b0&gt;

    def http_error_default(self, req, fp, code, msg, hdrs):
&gt;       raise HTTPError(req.full_url, code, msg, hdrs, fp)
E       urllib.error.HTTPError: HTTP Error 403: Forbidden
```

## Environment

* torch==1.3.1     
* torchvision==0.4.2

## Additional context

https://app.circleci.com/jobs/github/PyTorchLightning/pytorch-lightning/6877</span></p>
  </div>

  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>