Skip to content

torch.hub does not close the resource before removing #20757

@nv-kkudrynski

Description

@nv-kkudrynski

🐛 Bug

In the hub.py, line 169 should be preceded by:
cached_zipfile.close()
Otherwise on Windows, it will crash with PermissionException

To Reproduce

Steps to reproduce the behavior:

  1. Call torch.hub.load() on external repo on windows

File "...\python36pytorch\lib\site-packages\torch\hub.py", line 83, in _remove_if_exists
os.remove(path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: '.../.cache\torch\hub\master.zip'

Metadata

Metadata

Assignees

Labels

high prioritymodule: hubmodule: windowsWindows support for PyTorchsmallWe think this is a small issue to fix. Consider knocking off high priority small issuestriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions