diff --git a/.github/workflows/pip-install.yml b/.github/workflows/pip-install.yml index 29060bb67..b543cdfee 100644 --- a/.github/workflows/pip-install.yml +++ b/.github/workflows/pip-install.yml @@ -5,6 +5,8 @@ name: pip Install on: push: paths: [ "requirements*.yml", "conda-env-create.yml", "requirements/requirement*.txt", "setup*py", "setup*cfg", "pytproject*toml", "MANIFEST*in"] + pull_request: + paths: [ "requirements*.yml", "conda-env-create.yml", "requirements/requirement*.txt", "setup*py", "setup*cfg", "pytproject*toml", "MANIFEST*in"] jobs: build: @@ -19,16 +21,16 @@ jobs: uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - - name: 🐧 Install OpenSlide & OpenJPEG + - name: 🐧 Install OpenJPEG if: runner.os == 'Linux' run: | sudo apt update - sudo apt-get install -y libopenslide-dev openslide-tools libopenjp2-7 libopenjp2-tools + sudo apt-get install -y libopenjp2-7 libopenjp2-tools python -m pip install --upgrade pip - - name: 🍎 Install OpenSlide & OpenJPEG + - name: 🍎 Install OpenJPEG if: runner.os == 'macOS' run: | - brew install openslide openjpeg + brew install openjpeg python -m pip install --upgrade pip - name: 🪟 Install OpenJPEG if: runner.os == 'Windows' @@ -43,20 +45,6 @@ jobs: make -j4 make install make clean - - name: 🪟 Install OpenSlide - if: runner.os == 'Windows' - run: | - choco install wget --no-progress - wget https://github.com/openslide/openslide-winbuild/releases/download/v20220811/openslide-win64-20220811.zip - 7z x openslide-win64-20220811.zip - ls openslide-win64-20220811 - # Add to PATH - echo "$(realpath ./openslide-win64-20220811/bin)" >> $GITHUB_PATH - echo "$(realpath ./openslide-win64-20220811/lib)" >> $GITHUB_PATH - # Install - mkdir "C:\Program Files\openslide" - Copy-Item -Path ".\openslide-win64-20220811\*" -Destination "C:\Program Files\openslide" -Recurse - ls "C:/Program Files/openslide" - name: 🪟 Install SQLite Shell if: runner.os == 'Windows' run: choco install sqlite.shell --no-progress @@ -64,26 +52,21 @@ jobs: run: | sqlite3 --version sqlite3 ":memory:" -list ".output stdout" "pragma compile_options" ".exit" - - name: OpenSlide Version Information - if: runner.os == 'Linux' - run: openslide-quickhash1sum --version - name: OpenJPEG Version Information continue-on-error: true # This -h option has exit code 1 for some reason run: opj_dump -h - name: pip Install From GitHub Repo on Linux and macOS if: runner.os != 'Windows' - run: python -m pip install git+https://github.com/TissueImageAnalytics/tiatoolbox@${GITHUB_REF_NAME} + run: python -m pip install git+https://github.com/TissueImageAnalytics/tiatoolbox@${GITHUB_SHA} - name: pip Install From GitHub on Windows if: runner.os == 'Windows' - run: python -m pip install git+https://github.com/TissueImageAnalytics/tiatoolbox@$env:GITHUB_REF_NAME - - name: Test TIAToolbox Import + run: python -m pip install git+https://github.com/TissueImageAnalytics/tiatoolbox@$env:GITHUB_SHA + - name: Test Imports shell: python run: | - import os - if hasattr(os, "add_dll_directory"): - # Required for Python>=3.8 on Windows - with os.add_dll_directory(r"D:\a\tiatoolbox\tiatoolbox\openslide-win64-20220811\bin"): - import tiatoolbox - else: - os.environ["PATH"] = r"D:\a\tiatoolbox\tiatoolbox\openslide-win64-20220811\bin;" - import tiatoolbox + import tiatoolbox + print(tiatoolbox.__version__) + import openslide + print(openslide.__version__) + import torch + print(torch.__version__) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 160c460fd..64c62cae9 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -28,7 +28,7 @@ jobs: - name: Install dependencies run: | sudo apt update - sudo apt-get install -y libopenslide-dev openslide-tools libopenjp2-7 libopenjp2-tools + sudo apt-get install -y libopenjp2-7 libopenjp2-tools python -m pip install --upgrade pip python -m pip install ruff==0.11.8 pytest pytest-cov pytest-runner pip install -r requirements/requirements.txt @@ -42,8 +42,6 @@ jobs: echo "---SQlite---" sqlite3 --version sqlite3 ":memory:" -list ".output stdout" "pragma compile_options" ".exit" - echo "---Openslide---" - openslide-quickhash1sum --version echo "---OpenJPEG---" opj_dump -h | head -n 5 echo "---Python---" diff --git a/docs/installation.rst b/docs/installation.rst index 4739b2c86..808517739 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -17,16 +17,14 @@ On Linux, the prerequisite software can be installed using the following command .. code-block:: console - $ apt-get -y install libopenjp2-7-dev libopenjp2-tools openslide-tools + $ apt-get -y install libopenjp2-7-dev libopenjp2-tools The same command is used when working on the Colab or Kaggle platforms. When working on Google Colab, we remove the packages ``datascience`` and ``albumentations`` because they conflict and produce an error message. Windows (10+) ------------- -1. Download OpenSlide binaries from `this page `_. Extract the folder and add the ``bin`` and ``lib`` subdirectories to the Windows `system path `_. If you are using a conda environment, you can also copy the ``bin`` and ``lib`` subdirectories to ``[Anaconda Installation Path]/envs/[tiatoolbox-environment]/Library/``. - -2. Install OpenJPEG. The easiest way to install OpenJPEG is through conda: +On Windows, ``OpenJPEG`` can be installed using the following ``conda`` command: .. code-block:: console @@ -45,14 +43,14 @@ Homebrew .. code-block:: console - $ brew install openjpeg openslide + $ brew install openjpeg MacPorts ^^^^^^^^ .. code-block:: console - $ port install openjpeg openslide + $ port install openjpeg Installing Stable Release ========================= diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 9a9da3521..53d429253 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -16,7 +16,8 @@ matplotlib>=3.6.2 numba>=0.57.0 numpy>=1.23.5, <2.0.0 opencv-python>=4.6.0 -openslide-python>=1.2.0 +openslide-bin>=4.0.0.2 +openslide-python>=1.4.0 pandas>=2.0.0 pillow>=9.3.0 pydicom>=2.3.1 # Used by wsidicom