From 46264dfec9419bd22c413f674f78fb755860f420 Mon Sep 17 00:00:00 2001 From: Fivele-Li <128388363+Fivele-Li@users.noreply.github.com> Date: Wed, 26 Apr 2023 16:26:12 +0800 Subject: [PATCH] normpath for Windows (#1495) * path on Windows contains double '/' which may cause open file failed. * locate import numpy error * locate import numpy error * locate import numpy error * locate import numpy error * locate import numpy error * locate import numpy error * locate import numpy error * locate import numpy error * locate import numpy error * locate import numpy error * locate import numpy error * locate import numpy error * locate import numpy error * locate import numpy error * locate import numpy error * locate import numpy error * locate import numpy error * pip release version 23.1 on Apr.15 2023, CI failed to run, Please refer to #1495 ofr detailed logs. The pip version has been temporarily fixed to 23.0.1. --------- Co-authored-by: lijinhui <362237642@qq.com> --- .github/workflows/test_qlib_from_source.yml | 6 +++--- .github/workflows/test_qlib_from_source_slow.yml | 5 +++-- qlib/utils/__init__.py | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_qlib_from_source.yml b/.github/workflows/test_qlib_from_source.yml index 2052674a..68dfe5b3 100644 --- a/.github/workflows/test_qlib_from_source.yml +++ b/.github/workflows/test_qlib_from_source.yml @@ -28,8 +28,10 @@ jobs: python-version: ${{ matrix.python-version }} - name: Update pip to the latest version + # pip release version 23.1 on Apr.15 2023, CI failed to run, Please refer to #1495 ofr detailed logs. + # The pip version has been temporarily fixed to 23.0.1 run: | - python -m pip install --upgrade pip + python -m pip install pip==23.0.1 - name: Installing pytorch for macos if: ${{ matrix.os == 'macos-11' || matrix.os == 'macos-latest' }} @@ -39,13 +41,11 @@ jobs: - name: Installing pytorch for ubuntu if: ${{ matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' }} run: | - python -m pip install --upgrade pip python -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu - name: Installing pytorch for windows if: ${{ matrix.os == 'windows-latest' }} run: | - python -m pip install --upgrade pip python -m pip install torch torchvision torchaudio - name: Set up Python tools diff --git a/.github/workflows/test_qlib_from_source_slow.yml b/.github/workflows/test_qlib_from_source_slow.yml index 656687b8..f8e43fa1 100644 --- a/.github/workflows/test_qlib_from_source_slow.yml +++ b/.github/workflows/test_qlib_from_source_slow.yml @@ -28,9 +28,10 @@ jobs: python-version: ${{ matrix.python-version }} - name: Set up Python tools + # pip release version 23.1 on Apr.15 2023, CI failed to run, Please refer to #1495 ofr detailed logs. + # The pip version has been temporarily fixed to 23.0.1 run: | - python -m pip install --upgrade pip - # python -m pip is necessary to upgrade pip. + python -m pip install pip==23.0.1 pip install --upgrade cython numpy pip install -e .[dev] diff --git a/qlib/utils/__init__.py b/qlib/utils/__init__.py index edf2459b..51363f2f 100644 --- a/qlib/utils/__init__.py +++ b/qlib/utils/__init__.py @@ -428,7 +428,7 @@ def init_instance_by_config( pr = urlparse(config) if pr.scheme == "file": pr_path = os.path.join(pr.netloc, pr.path) if bool(pr.path) else pr.netloc - with open(pr_path, "rb") as f: + with open(os.path.normpath(pr_path), "rb") as f: return pickle.load(f) else: with config.open("rb") as f: