Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Error 404: Not Found when downloading StanfordCars #7681

Closed
xmfan opened this issue Jun 19, 2023 · 1 comment
Closed

HTTP Error 404: Not Found when downloading StanfordCars #7681

xmfan opened this issue Jun 19, 2023 · 1 comment

Comments

@xmfan
Copy link
Member

xmfan commented Jun 19, 2023

🐛 Describe the bug

When downloading StanfordCars, torchvision attemps to download a resource at https://ai.stanford.edu/~jkrause/cars/car_devkit.tgz, but the resource is no longer available

To reproduce:

import torchvision
torchvision.datasets.StanfordCars(root='.', download=True)

Stack trace:

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
Cell In[9], line 2
      1 import torchvision
----> 2 torchvision.datasets.StanfordCars(root='.', download=True)

File ~/projects/ldm/.venv/lib/python3.10/site-packages/torchvision/datasets/stanford_cars.py:60, in StanfordCars.__init__(self, root, split, transform, target_transform, download)
     57     self._images_base_path = self._base_folder / "cars_test"
     59 if download:
---> 60     self.download()
     62 if not self._check_exists():
     63     raise RuntimeError("Dataset not found. You can use download=True to download it")

File ~/projects/ldm/.venv/lib/python3.10/site-packages/torchvision/datasets/stanford_cars.py:94, in StanfordCars.download(self)
     91 if self._check_exists():
     92     return
---> 94 download_and_extract_archive(
     95     url="https://ai.stanford.edu/~jkrause/cars/car_devkit.tgz",
     96     download_root=str(self._base_folder),
     97     md5="c3b158d763b6e2245038c8ad08e45376",
     98 )
     99 if self._split == "train":
    100     download_and_extract_archive(
    101         url="https://ai.stanford.edu/~jkrause/car196/cars_train.tgz",
    102         download_root=str(self._base_folder),
    103         md5="065e5b463ae28d29e77c1b4b166cfe61",
    104     )

File ~/projects/ldm/.venv/lib/python3.10/site-packages/torchvision/datasets/utils.py:434, in download_and_extract_archive(url, download_root, extract_root, filename, md5, remove_finished)
    431 if not filename:
    432     filename = os.path.basename(url)
--> 434 download_url(url, download_root, filename, md5)
    436 archive = os.path.join(download_root, filename)
    437 print(f"Extracting {archive} to {extract_root}")

File ~/projects/ldm/.venv/lib/python3.10/site-packages/torchvision/datasets/utils.py:134, in download_url(url, root, filename, md5, max_redirect_hops)
    131     _download_file_from_remote_location(fpath, url)
    132 else:
    133     # expand redirect chain if needed
--> 134     url = _get_redirect_url(url, max_hops=max_redirect_hops)
    136     # check if file is located on Google Drive
    137     file_id = _get_google_drive_file_id(url)

File ~/projects/ldm/.venv/lib/python3.10/site-packages/torchvision/datasets/utils.py:82, in _get_redirect_url(url, max_hops)
     79 headers = {"Method": "HEAD", "User-Agent": USER_AGENT}
     81 for _ in range(max_hops + 1):
---> 82     with urllib.request.urlopen(urllib.request.Request(url, headers=headers)) as response:
     83         if response.url == url or response.url is None:
     84             return url

File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py:216, in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    214 else:
    215     opener = _opener
--> 216 return opener.open(url, data, timeout)

File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py:525, in OpenerDirector.open(self, fullurl, data, timeout)
    523 for processor in self.process_response.get(protocol, []):
    524     meth = getattr(processor, meth_name)
--> 525     response = meth(req, response)
    527 return response

File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py:634, in HTTPErrorProcessor.http_response(self, request, response)
    631 # According to RFC 2616, "2xx" code indicates that the client's
    632 # request was successfully received, understood, and accepted.
    633 if not (200 <= code < 300):
--> 634     response = self.parent.error(
    635         'http', request, response, code, msg, hdrs)
    637 return response

File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py:563, in OpenerDirector.error(self, proto, *args)
    561 if http_err:
    562     args = (dict, 'default', 'http_error_default') + orig_args
--> 563     return self._call_chain(*args)

File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py:496, in OpenerDirector._call_chain(self, chain, kind, meth_name, *args)
    494 for handler in handlers:
    495     func = getattr(handler, meth_name)
--> 496     result = func(*args)
    497     if result is not None:
    498         return result

File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py:643, in HTTPDefaultErrorHandler.http_error_default(self, req, fp, code, msg, hdrs)
    642 def http_error_default(self, req, fp, code, msg, hdrs):
--> 643     raise HTTPError(req.full_url, code, msg, hdrs, fp)

HTTPError: HTTP Error 404: Not Found

Versions

Collecting environment information...
PyTorch version: 2.0.1
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 13.3.1 (arm64)
GCC version: Could not collect
Clang version: 14.0.3 (clang-1403.0.22.14.1)
CMake version: Could not collect
Libc version: N/A

Python version: 3.10.11 (v3.10.11:7d4cc5aa85, Apr  4 2023, 19:05:19) [Clang 13.0.0 (clang-1300.0.29.30)] (64-bit runtime)
Python platform: macOS-13.3.1-arm64-arm-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Apple M2 Pro

Versions of relevant libraries:
[pip3] numpy==1.25.0
[pip3] torch==2.0.1
[pip3] torchvision==0.15.2
[conda] Could not collect
@pmeier
Copy link
Collaborator

pmeier commented Jun 19, 2023

Duplicate of #7545.

@pmeier pmeier closed this as completed Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants