From c11498d0c12357f448dedea0fa61262714f4fa11 Mon Sep 17 00:00:00 2001 From: Aki Nitta Date: Sun, 30 May 2021 21:04:38 +0900 Subject: [PATCH] [RFC] Change installation for extra packages (#346) * Update installation * Update requirements/devel.txt * Update installation in CI * Update installation doc * Fix docs-check.yml * Fix docs-deploy.yml * Fix config.yml * Update installation in README.md * Fix docs-check.yml * Fix docs-check.yml * Drop editable mode * Update changelog --- .azure-pipelines/gpu-tests.yml | 3 ++- .circleci/config.yml | 4 ++-- .github/workflows/ci-testing.yml | 4 ++-- .github/workflows/docs-check.yml | 11 ++++++----- .github/workflows/docs-deploy.yml | 4 ++-- CHANGELOG.md | 4 ++++ README.md | 4 +++- docs/source/installation.md | 33 +++++++++++++++++++++++++++---- requirements/devel.txt | 10 ++++++---- setup.py | 7 ++----- 10 files changed, 58 insertions(+), 26 deletions(-) diff --git a/.azure-pipelines/gpu-tests.yml b/.azure-pipelines/gpu-tests.yml index 7493ad9b46..4d4684e4db 100644 --- a/.azure-pipelines/gpu-tests.yml +++ b/.azure-pipelines/gpu-tests.yml @@ -50,7 +50,8 @@ jobs: - bash: | # python -m pip install "pip==20.1" - pip install --requirement ./requirements/devel.txt --upgrade-strategy only-if-needed + pip install '.[all]' + pip install '.[test]' --upgrade-strategy only-if-needed pip list displayName: 'Install dependencies' diff --git a/.circleci/config.yml b/.circleci/config.yml index 6b3a645e9f..bcd865aeb3 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,8 +13,8 @@ references: # we need to use py3.7 ot higher becase of an issue with metaclass inheritence pyenv global 3.7.3 python --version - pip install -e . - pip install -r requirements/docs.txt --progress-bar off + pip install . --progress-bar off + pip install --requirement ./requirements/docs.txt --progress-bar off pip list cd docs make clean diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 179a00a051..1e060084df 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -92,8 +92,8 @@ jobs: run: | python --version pip --version - pip install -e '.[${{ matrix.topic }}]' --pre --upgrade --find-links https://download.pytorch.org/whl/cpu/torch_stable.html - pip install --requirement requirements/test.txt --upgrade + pip install '.[${{ matrix.topic }}]' --pre --upgrade --find-links https://download.pytorch.org/whl/cpu/torch_stable.html + pip install '.[test]' --pre --upgrade pip list shell: bash diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index ba8c6eec16..7793011681 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -15,7 +15,7 @@ jobs: with: # git is required to clone the docs theme # before custom requirement are resolved https://github.com/ammaraskar/sphinx-action/issues/16 - pre-build-command: "apt-get update -y && apt-get install -y gcc git pandoc && pip install -e . && pip install -r requirements/docs.txt" + pre-build-command: "apt-get update -y && apt-get install -y gcc git pandoc && pip install . && pip install -r ./requirements/docs.txt" docs-folder: "docs/" repo-token: "${{ secrets.GITHUB_TOKEN }}" - uses: actions/upload-artifact@v2 @@ -47,8 +47,8 @@ jobs: run: | python --version pip --version - pip install -e . - pip install -r requirements/docs.txt + pip install . --find-links https://download.pytorch.org/whl/cpu/torch_stable.html + pip install --requirement ./requirements/docs.txt # install Texlive, see https://linuxconfig.org/how-to-install-latex-on-ubuntu-20-04-focal-fossa-linux sudo apt-get update && sudo apt-get install -y texlive-latex-extra dvipng texlive-pictures pip list @@ -90,8 +90,9 @@ jobs: - name: Install dependencies run: | - pip install -e '.[dev-test]' --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet - pip install --requirement requirements/docs.txt --upgrade-strategy only-if-needed + pip install '.[all]' --find-links https://download.pytorch.org/whl/cpu/torch_stable.html + pip install '.[test]' --find-links https://download.pytorch.org/whl/cpu/torch_stable.html + pip install --requirement ./requirements/docs.txt python --version pip --version pip list diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml index aa7f45d8a1..6b3e07b3fd 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yml @@ -29,8 +29,8 @@ jobs: ${{ runner.os }}-pip- - name: Install dependencies run: | - pip install . --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet - pip install --requirement requirements/docs.txt --upgrade-strategy only-if-needed + pip install . --find-links https://download.pytorch.org/whl/cpu/torch_stable.html + pip install --requirement ./requirements/docs.txt # install Texlive, see https://linuxconfig.org/how-to-install-latex-on-ubuntu-20-04-focal-fossa-linux sudo apt-get update sudo apt-get install -y texlive-latex-extra dvipng texlive-pictures diff --git a/CHANGELOG.md b/CHANGELOG.md index 99c916b7a0..8c3bdfb916 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Fixed `flash.Trainer.add_argparse_args` not adding any arguments ([#343](https://github.com/PyTorchLightning/lightning-flash/pull/343)) +### Changed + +- Changed the installation command for extra features ([#346](https://github.com/PyTorchLightning/lightning-flash/pull/346)) + - Fixed a bug where the translation task wasn't decoding tokens properly ([#332](https://github.com/PyTorchLightning/lightning-flash/pull/332)) diff --git a/README.md b/README.md index 209c43bb5d..239b32d28c 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Pip / conda ```bash -pip install lightning-flash -U +pip install lightning-flash ```
@@ -75,10 +75,12 @@ cd lightning-flash # install in editable mode pip install -e . ``` + In case you want to use the extra packages from a specific domain (image, video, text, ...) ```bash pip install "lightning-flash[image]" ``` +See [Installation](https://lightning-flash.readthedocs.io/en/latest/installation.html) for more options.
--- diff --git a/docs/source/installation.md b/docs/source/installation.md index 7d770a6baf..5c7a9ccd4a 100644 --- a/docs/source/installation.md +++ b/docs/source/installation.md @@ -1,15 +1,40 @@ # Installation -Flash is tested on Python 3.6+, and PyTorch 1.6 +Flash is tested on Python 3.6+, and PyTorch 1.6. -## Install with pip/conda +## Install with pip ```bash -pip install lightning-flash -U +pip install lightning-flash +``` + +Optionally, you can install Flash with extra pacakges for each domain or all domains. +```bash +pip install 'lightning-flash[image]' +pip install 'lightning-flash[image_style_transfer]' +pip install 'lightning-flash[tabular]' +pip install 'lightnign-flash[text]' +pip install 'lightning-flash[video]' + +# image + image_style_transfer + video +pip install 'lightning-flash[vision]' + +# all features +pip install 'lightning-flash[all]' +``` + +For contributors, please install Flash with packages for testing Flash and building docs. +```bash +# Clone Flash repository locally +git clone https://github.com/[your username]/lightning-flash.git +cd lightning-flash + +# Install Flash in editable mode with extra packages for development +pip install -e '.[dev]' ``` ## Install from source -``` bash +```bash pip install git+https://github.com/PyTorchLightning/lightning-flash.git ``` diff --git a/requirements/devel.txt b/requirements/devel.txt index 5e00c1f878..4baa0f7bca 100644 --- a/requirements/devel.txt +++ b/requirements/devel.txt @@ -1,11 +1,13 @@ -# install all mandatory dependencies - -r ../requirements.txt +-r ../requirements.txt - # extended list of dependencies for development and run lint and tests - -r ./test.txt +-r ./test.txt + +-r ./docs.txt -r ./datatype_image.txt +-r ./datatype_image_style_transfer.txt + -r ./datatype_tabular.txt -r ./datatype_text.txt diff --git a/setup.py b/setup.py index 3fe52e9f28..a8bc21d24a 100644 --- a/setup.py +++ b/setup.py @@ -57,11 +57,8 @@ def _load_py_module(fname, pkg="flash"): # remove possible duplicate. extras["vision"] = list(set(extras["image"] + extras["video"] + extras["image_style_transfer"])) -extras["dev"] = list(set(extras["vision"] + extras["tabular"] + extras["text"] + extras["image"])) -extras["dev-test"] = list(set(extras["test"] + extras["dev"])) -extras["all"] = list(set(extras["dev"] + extras["docs"])) - -print(extras) +extras["all"] = list(set(extras["vision"] + extras["tabular"] + extras["text"])) +extras["dev"] = list(set(extras["all"] + extras["test"] + extras["docs"])) # https://packaging.python.org/discussions/install-requires-vs-requirements / # keep the meta-data here for simplicity in reading this file... it's not obvious