From 5d4dc1316a3df4718b8fef030dd09d54c4445d66 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Mon, 31 Jan 2022 12:28:20 +0000 Subject: [PATCH 1/4] ignore 60.6.0 Signed-off-by: Wenqi Li --- requirements-min.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-min.txt b/requirements-min.txt index 195f6f49f4..63906b4a94 100644 --- a/requirements-min.txt +++ b/requirements-min.txt @@ -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 From 6e6dc0cd956ce0b1ed1923be69b8b1750b2da8d7 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Mon, 31 Jan 2022 13:26:00 +0000 Subject: [PATCH 2/4] workaround #3752 Signed-off-by: Wenqi Li --- .github/workflows/pythonapp-gpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonapp-gpu.yml b/.github/workflows/pythonapp-gpu.yml index 848eaedcd6..7825c03ae1 100644 --- a/.github/workflows/pythonapp-gpu.yml +++ b/.github/workflows/pythonapp-gpu.yml @@ -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 }} From a15423178cf20b9d04399e6b59d6d1ea58d9ad5a Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Mon, 31 Jan 2022 17:33:44 +0000 Subject: [PATCH 3/4] fixes windows issue Signed-off-by: Wenqi Li --- monai/apps/utils.py | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/monai/apps/utils.py b/monai/apps/utils.py index 9db62f336d..2e5450087f 100644 --- a/monai/apps/utils.py +++ b/monai/apps/utils.py @@ -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: # project-monai/monai issue #3613 + 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}, " From 2b093b7519610373ea362754f9c71a3d9de7e66a Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Mon, 31 Jan 2022 18:54:11 +0000 Subject: [PATCH 4/4] workaround #3757 Signed-off-by: Wenqi Li --- monai/apps/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monai/apps/utils.py b/monai/apps/utils.py index 2e5450087f..209dc796cf 100644 --- a/monai/apps/utils.py +++ b/monai/apps/utils.py @@ -200,7 +200,7 @@ def download_url( 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: # project-monai/monai issue #3613 + 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):