Skip to content

urllib issue urllib.error.HTTPError: HTTP Error 503: Service Unavailable #12

@FischerJo

Description

@FischerJo

I just installed the dependencies and tried to run the example

python3 main.py --prune_type=lt --arch_type=fc1 --dataset=mnist --prune_percent=10 --prune_iterations=35

and got the following error

Downloading http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz to ../data/MNIST/raw/train-images-idx3-ubyte.gz
Traceback (most recent call last):
  File "main.py", line 427, in <module>
    main(args, ITE=1)
  File "main.py", line 39, in main
    traindataset = datasets.MNIST('../data', train=True, download=True,transform=transform)
  File "/home/fischer/miniconda3/lib/python3.8/site-packages/torchvision/datasets/mnist.py", line 79, in __init__
    self.download()
  File "/home/fischer/miniconda3/lib/python3.8/site-packages/torchvision/datasets/mnist.py", line 146, in download
    download_and_extract_archive(url, download_root=self.raw_folder, filename=filename, md5=md5)
  File "/home/fischer/miniconda3/lib/python3.8/site-packages/torchvision/datasets/utils.py", line 314, in download_and_extract_archive
    download_url(url, download_root, filename, md5)
  File "/home/fischer/miniconda3/lib/python3.8/site-packages/torchvision/datasets/utils.py", line 140, in download_url
    raise e
  File "/home/fischer/miniconda3/lib/python3.8/site-packages/torchvision/datasets/utils.py", line 132, in download_url
    _urlretrieve(url, fpath)
  File "/home/fischer/miniconda3/lib/python3.8/site-packages/torchvision/datasets/utils.py", line 29, in _urlretrieve
    with urllib.request.urlopen(urllib.request.Request(url, headers={"User-Agent": USER_AGENT})) as response:
  File "/home/fischer/miniconda3/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/home/fischer/miniconda3/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/home/fischer/miniconda3/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/home/fischer/miniconda3/lib/python3.8/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/home/fischer/miniconda3/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/home/fischer/miniconda3/lib/python3.8/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 503: Service Unavailable

My guess is that the side somehow blocks the request (blocks python script requests, requires captcha solving,...), as a google search revealed similar issues with this library.
Is there any workaround?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions