torchgeo icon indicating copy to clipboard operation
torchgeo copied to clipboard

ChesapeakeCVPR Dataset and ChesapeakeCVPRDataModule throws HTTP Error 403 when downloading

Open Nobatgeldi opened this issue 1 year ago • 2 comments

I'm getting a 403 error when I try to download ChesapeakeCVPR dataset with torchgeo I can download file with browser on my local machine

chesapeake_root = os.path.join(tempfile.gettempdir(), 'chesapeake')
os.makedirs(chesapeake_root, exist_ok=True)
chesapeake = ChesapeakeCVPR(chesapeake_root, download=True)

https://github.com/microsoft/torchgeo/blob/3bd85a6f5d4439e40cdfbc1e44cd7eb3fb21f5af/torchgeo/datasets/chesapeake.py#L341

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
[<ipython-input-33-009018e0ed8d>](https://localhost:8080/#) in <cell line: 1>()
----> 1 trainer.fit(model=task, datamodule=datamodule)

17 frames
[/usr/lib/python3.10/urllib/request.py](https://localhost:8080/#) in http_error_default(self, req, fp, code, msg, hdrs)
    641 class HTTPDefaultErrorHandler(BaseHandler):
    642     def http_error_default(self, req, fp, code, msg, hdrs):
--> 643         raise HTTPError(req.full_url, code, msg, hdrs, fp)
    644 
    645 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 403: This request is not authorized to perform this operation.

Nobatgeldi avatar Dec 07 '24 14:12 Nobatgeldi

I'm getting a 403 error when I try to download ChesapeakeCVPR dataset with torchgeo I can download file with browser on my local machine

chesapeake_root = os.path.join(tempfile.gettempdir(), 'chesapeake')
os.makedirs(chesapeake_root, exist_ok=True)
chesapeake = ChesapeakeCVPR(chesapeake_root, download=True)

torchgeo/torchgeo/datasets/chesapeake.py

Line 341 in 3bd85a6

'base': 'https://lilawildlife.blob.core.windows.net/lila-wildlife/lcmcvpr2019/cvpr_chesapeake_landcover.zip',

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
[<ipython-input-33-009018e0ed8d>](https://localhost:8080/#) in <cell line: 1>()
----> 1 trainer.fit(model=task, datamodule=datamodule)

17 frames
[/usr/lib/python3.10/urllib/request.py](https://localhost:8080/#) in http_error_default(self, req, fp, code, msg, hdrs)
    641 class HTTPDefaultErrorHandler(BaseHandler):
    642     def http_error_default(self, req, fp, code, msg, hdrs):
--> 643         raise HTTPError(req.full_url, code, msg, hdrs, fp)
    644 
    645 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 403: This request is not authorized to perform this operation.

When I try to download with wget command, it starts to download, but using download_url fucntion, it throws HTTP 403 exception.

Image

Nobatgeldi avatar Dec 07 '24 14:12 Nobatgeldi

Duplicate of #2390, fixed by #2445

adamjstewart avatar Dec 08 '24 13:12 adamjstewart