Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

[RFC] Change installation for extra packages #346

Merged
merged 13 commits into from
May 30, 2021
3 changes: 2 additions & 1 deletion .azure-pipelines/gpu-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/docs-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
Pip / conda

```bash
pip install lightning-flash -U
pip install lightning-flash
```

<details>
Expand All @@ -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.
</details>

---
Expand Down
33 changes: 29 additions & 4 deletions docs/source/installation.md
Original file line number Diff line number Diff line change
@@ -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
```
10 changes: 6 additions & 4 deletions requirements/devel.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down