Skip to content

PascalVOC dataset download urllib error - [Errno 113] No route to host #2829

@ManiadisG

Description

@ManiadisG

🐛 Bug

Trying to download the PascalVOC Detection dataset returns the following error message.
This was tested both locally and in Google Colab.

Downloading http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar to datasets/VOCtrainval_11-May-2012.tar
0it [00:00, ?it/s]Traceback (most recent call last):
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/urllib/request.py", line 1350, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/http/client.py", line 1277, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/http/client.py", line 1323, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/http/client.py", line 1272, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/http/client.py", line 1032, in _send_output
    self.send(msg)
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/http/client.py", line 972, in send
    self.connect()
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/http/client.py", line 944, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/socket.py", line 728, in create_connection
    raise err
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/socket.py", line 716, in create_connection
    sock.connect(sa)
OSError: [Errno 113] No route to host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/site-packages/torchvision/datasets/voc.py", line 180, in __init__
    download_extract(self.url, self.root, self.filename, self.md5)
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/site-packages/torchvision/datasets/voc.py", line 240, in download_extract
    download_url(url, root, filename, md5)
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/site-packages/torchvision/datasets/utils.py", line 83, in download_url
    raise e
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/site-packages/torchvision/datasets/utils.py", line 71, in download_url
    reporthook=gen_bar_updater()
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/urllib/request.py", line 247, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/urllib/request.py", line 1378, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/home/user/anaconda3/envs/torch_env/lib/python3.7/urllib/request.py", line 1352, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 113] No route to host>

To Reproduce

Steps to reproduce the behavior:

import torchvision
data = torchvision.datasets.VOCDetection('datasets/', year='2007', image_set='train', download=True, transform=None,target_transform=None, transforms=None)

Expected behavior

The dataset should be downloaded.

Environment

The information below relates to the local configuration. For Google Colab I did not examine the environment, I just ran the two commands above.

  • PyTorch / torchvision Version (e.g., 1.6 / 0.7.0):
  • OS (e.g., Linux): Ubuntu 20.04
  • How you installed PyTorch / torchvision (conda, pip, source): Conda
  • Build command you used (if compiling from source):
  • Python version: 3.7
  • CUDA/cuDNN version: 10.2

Additional context

Tested locally and in Google Colab. I also tried downloading MNIST via torchvision.datasets and it worked.

cc @pmeier

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions