Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pythonapp-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
- name: Install dependencies
run: |
which python
python -m pip install --upgrade pip wheel
python -m pip install --upgrade pip==21.3.1 wheel # workaround monai##3752
# fixes preinstalled ruamel_yaml error from the docker image
rm -rf $(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/ruamel*
python -m pip install ${{ matrix.pytorch }}
Expand Down
38 changes: 20 additions & 18 deletions monai/apps/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,24 +183,26 @@ def download_url(
)
logger.info(f"File exists: {filepath}, skipped downloading.")
return

with tempfile.TemporaryDirectory() as tmp_dir:
tmp_name = Path(tmp_dir, _basename(filepath))
if urlparse(url).netloc == "drive.google.com":
if not has_gdown:
raise RuntimeError("To download files from Google Drive, please install the gdown dependency.")
gdown.download(url, f"{tmp_name}", quiet=not progress)
else:
_download_with_progress(url, tmp_name, progress=progress)
if not tmp_name.exists():
raise RuntimeError(
f"Download of file from {url} to {filepath} failed due to network issue or denied permission."
)
file_dir = filepath.parent
if file_dir:
os.makedirs(file_dir, exist_ok=True)
shutil.move(f"{tmp_name}", f"{filepath}") # copy the downloaded to a user-specified cache.
logger.info(f"Downloaded: {filepath}")
try:
with tempfile.TemporaryDirectory() as tmp_dir:
tmp_name = Path(tmp_dir, _basename(filepath))
if urlparse(url).netloc == "drive.google.com":
if not has_gdown:
raise RuntimeError("To download files from Google Drive, please install the gdown dependency.")
gdown.download(url, f"{tmp_name}", quiet=not progress)
else:
_download_with_progress(url, tmp_name, progress=progress)
if not tmp_name.exists():
raise RuntimeError(
f"Download of file from {url} to {filepath} failed due to network issue or denied permission."
)
file_dir = filepath.parent
if file_dir:
os.makedirs(file_dir, exist_ok=True)
shutil.move(f"{tmp_name}", f"{filepath}") # copy the downloaded to a user-specified cache.
except (PermissionError, NotADirectoryError): # project-monai/monai issue #3613 #3757 for windows
pass
logger.info(f"Downloaded: {filepath}")
if not check_hash(filepath, hash_val, hash_type):
raise RuntimeError(
f"{hash_type} check of downloaded file failed: URL={url}, "
Expand Down
2 changes: 1 addition & 1 deletion requirements-min.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Requirements for minimal tests
-r requirements.txt
setuptools>=50.3.0,!=60.0.0
setuptools>=50.3.0,!=60.0.0,!=60.6.0
coverage>=5.5
parameterized