diff --git a/.flake8 b/.flake8 deleted file mode 100644 index b61e46d48..000000000 --- a/.flake8 +++ /dev/null @@ -1,5 +0,0 @@ -[flake8] -ignore = E203, E266, E501, W503, F403, F401 -max-line-length = 89 -max-complexity = 18 -select = B,C,E,F,W,T4,B9 \ No newline at end of file diff --git a/.github/workflows/docker-nightly-release.yml b/.github/workflows/docker-nightly-release.yml index 8bdbfab7e..34aef6a6e 100644 --- a/.github/workflows/docker-nightly-release.yml +++ b/.github/workflows/docker-nightly-release.yml @@ -21,6 +21,9 @@ on: paths: - 'docker/nightly/**' - '.github/workflows/docker-nightly-release.yml' + - 'requirements.txt' + - 'setup.py' + - 'extra_dependencies.py' jobs: docker-nightly-release: diff --git a/.github/workflows/environment-update.yml b/.github/workflows/environment-update.yml index 4e67ad5c9..ca052dfe7 100644 --- a/.github/workflows/environment-update.yml +++ b/.github/workflows/environment-update.yml @@ -17,7 +17,9 @@ on: - master paths: - '.github/workflows/environment-update.yml' - - 'environment.yml' + - 'requirements.txt' + - 'setup.py' + - 'extra_dependencies.py' schedule: - cron: '0 0 * * 0' # midnight of every Sunday @@ -73,30 +75,6 @@ jobs: ref: master path: 'avalanche-docker' token: ${{ secrets.BOT_TOKEN }} - - name: test failure - if: failure() - shell: bash -l -c "conda run -n avalanche-env --no-capture-output bash {0}" - run: | - conda env export > failed-environment.yml && - diff avalanche-docker/${{ matrix.python-version }}/environment-${{ matrix.python-version }}.yml failed-environment.yml > diff_fail.txt - - name: test failure - open an issue - if: failure() - uses: actions/github-script@v3 - with: - github-token: ${{ secrets.BOT_TOKEN }} - script: | - var title = "Creation of a new envirnment failed for python " + ${{ matrix.python-version }} - var message = "Here are the differences between the last working environment and the new one that I tried to run:\n\n```\n" - var fs = require("fs"); - var diff = fs.readFileSync("diff_fail.txt", "utf-8"); - var text_complete = message.concat(diff, "\n```") - github.issues.create({ - owner: context.repo.owner, - repo: context.repo.repo, - title: title, - body: text_complete, - labels: ['Continuous integration', 'test'] - }) - name: test success if: success() shell: bash -l -c "conda run -n avalanche-env --no-capture-output bash {0}" diff --git a/.github/workflows/test-coverage-coveralls.yml b/.github/workflows/test-coverage-coveralls.yml index a39faab2e..76cda636b 100644 --- a/.github/workflows/test-coverage-coveralls.yml +++ b/.github/workflows/test-coverage-coveralls.yml @@ -18,14 +18,12 @@ on: paths: - '**.py' - '.github/workflows/test-coverage-coveralls.yml' - - 'environment.yml' pull_request: branches: - master paths: - '**.py' - '.github/workflows/test-coverage-coveralls.yml' - - 'environment.yml' jobs: unit-test: diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index c7b00f191..975536622 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -19,7 +19,6 @@ on: paths: - '**.py' - '.github/workflows/unit-test.yml' - - 'environment.yml' pull_request: branches: - master @@ -27,7 +26,8 @@ on: paths: - '**.py' - '.github/workflows/unit-test.yml' - - 'environment.yml' + - 'requirements.txt' + - 'extra_dependencies.py' jobs: unit-test: diff --git a/docs/gitbook/getting-started/how-to-install.md b/docs/gitbook/getting-started/how-to-install.md index 770944fc4..72e382ec8 100644 --- a/docs/gitbook/getting-started/how-to-install.md +++ b/docs/gitbook/getting-started/how-to-install.md @@ -32,6 +32,8 @@ Avalanche will raise an error if you need one extra package and will suggest the **Note** that in some alternatives to bash like zsh you may need to enclose \`avalanche-lib\[code]\` into quotation marks ( " " ), since square brackets are used as special characters. +**Warning**: by installing the [all] and [extra] versions, the PyTorch version may be limited to <2.* due to the dependencies of those additional packages. + ## 📥 Install the Master Branch Using Pip If you want, you can install Avalanche directly from the master branch (latest version) in a single command. Make sure to have **pytorch** already installed in your environment, then execute @@ -42,69 +44,13 @@ pip install git+https://github.com/ContinualAI/avalanche.git To update avalanche to the latest version, uninstall the package with `pip uninstall avalanche-lib` and then execute again the pip install command. -## 🐍 Install the Master Branch Using Anaconda - -We suggest you to use the _pip package_, but if you need some recent features you may want to install directly from the **master branch**. In general, the master branch is well tested and safe to use. However, the API of new features may change more frequently or break backward compatibility. _Reproducibility is also easier if you use the pip package._ - -```bash -# choose your python version -python="3.8" - -# Step 1 -git clone https://github.com/ContinualAI/avalanche.git -cd avalanche -conda create -n avalanche-env python=$python -c conda-forge -conda activate avalanche-env - -# Step 2 -# Istall Pytorch with Conda (instructions here: https://pytorch.org/) - -# Step 3 -conda env update --file environment.yml -``` - -{% hint style="info" %} -On **Linux**, alternatively, you can simply run the `install_environment.sh` in the _Avalanche_ home directory. The script takes 2 arguments: `--python` and `--cuda_version`. Check `--help` for details. -{% endhint %} - -You can test your installation by running the `examples/test_install.py` script. Make sure to include avalanche into your **$PYTHONPATH** if you are running examples with the command line interface. - ## 💻 Developer Mode Install -If you want to expand _Avalanche_ and help us improve it (see the "[_From Zero to Hero_](../from-zero-to-hero-tutorial/03\_benchmarks.md)" Tutorial). In this case we suggest to create an environment in _**developer-mode**_ as follows (just a couple of more dependencies will be installed). - -Assuming you have **Anaconda (or Miniconda) installed** on your system, you can follow these simple steps: - -1. Install the `avalanche-dev-env` environment and activate it. -2. [Install Pytorch + TorchVision](https://pytorch.org) (follow the instructions on the website to use conda). -3. Update the Conda Environment. - -These three steps can be accomplished with the following lines of code: - -```bash -# choose you python version -python="3.8" - -# Step 1 -git clone https://github.com/ContinualAI/avalanche.git -cd avalanche -conda create -n avalanche-dev-env python=$python -c conda-forge -conda activate avalanche-dev-env - -# Step 2 -# Istall Pytorch with Conda (instructions here: https://pytorch.org/) - -# Step 3 -conda env update --file environment-dev.yml -``` - -{% hint style="info" %} -On **Linux**, alternatively, you can simply run the `install_environment_dev.sh` in the _Avalanche_ home directory. The script takes 2 arguments: `--python` and `--cuda_version`. Check `--help` for details. -{% endhint %} +To help us to expand and improve _Avalanche_, you can install Avalanche in a fresh environment with the command -You can test your installation by running the `examples/test_install.py` script. Make sure to include avalanche into your **$PYTHONPATH** if you are running examples with the command line interface. +```pip install -e ".[dev]"``` -That's it. now we have _Avalanche_ up and running and we can start contribute to it! +This will install in editable mode, so that you can develop and modify the installed Avalanche package. It will also install the "extra" dev dependencies necessary to run tests and build the documentation. ## 🤝 Run it on Google Colab diff --git a/environment-dev.yml b/environment-dev.yml deleted file mode 100644 index c2a75b9f2..000000000 --- a/environment-dev.yml +++ /dev/null @@ -1,40 +0,0 @@ -################################################################################ -# Copyright (c) 2021 ContinualAI. # -# Copyrights licensed under the MIT License. # -# See the accompanying LICENSE file for terms. # -# # -# Date: 1-05-2020 # -# Author(s): Vincenzo Lomonaco # -# E-mail: contact@continualai.org # -# Website: avalanche.continualai.org # -################################################################################ - -channels: -- conda-forge -dependencies: -- pip -- psutil -- conda-forge::gputil -- wandb -- tensorboard>=1.15 -- scikit-learn -- matplotlib -- numpy -- conda-forge::quadprog -- tqdm -- conda-forge::pycocotools -- conda-forge::torchmetrics -- conda-forge::pycodestyle -- sphinx -- sphinx_rtd_theme -- conda-forge::astroid=2.4.2 -- conda-forge::sphinx-autoapi -- conda-forge::sphinx-copybutton -- pip: - - typing-extensions - - pytorchcv - - gdown - - higher - - gym - - lvis - - dill diff --git a/environment.yml b/environment.yml deleted file mode 100644 index ec403e517..000000000 --- a/environment.yml +++ /dev/null @@ -1,34 +0,0 @@ -################################################################################ -# Copyright (c) 2021 ContinualAI. # -# Copyrights licensed under the MIT License. # -# See the accompanying LICENSE file for terms. # -# # -# Date: 09-02-2021 # -# Author(s): Gabriele Graffieti # -# E-mail: contact@continualai.org # -# Website: avalanche.continualai.org # -################################################################################ - -channels: -- conda-forge -dependencies: -- pip -- psutil -- conda-forge::gputil -- wandb -- tensorboard>=1.15 -- scikit-learn -- matplotlib -- numpy -- conda-forge::quadprog -- tqdm -- conda-forge::pycocotools -- conda-forge::torchmetrics -- pip: - - typing-extensions - - pytorchcv - - gdown - - gym - - higher - - lvis - - dill diff --git a/extra_dependencies.txt b/extra_dependencies.txt index 2bdcd480a..330556bd1 100644 --- a/extra_dependencies.txt +++ b/extra_dependencies.txt @@ -10,3 +10,7 @@ gym: rl pycocotools: detection lvis: detection timm: l2p +sphinx: dev +sphinx_rtd_theme: dev +sphinx_autoapi: dev +sphinx_copybutton: dev diff --git a/install_environment.sh b/install_environment.sh deleted file mode 100644 index adbc14de5..000000000 --- a/install_environment.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/bash - -################################################################################ -# Copyright (c) 2021 ContinualAI. # -# Copyrights licensed under the MIT License. # -# See the accompanying LICENSE file for terms. # -# # -# Date: 09-02-2021 # -# Author(s): Gabriele Graffieti # -# E-mail: contact@continualai.org # -# Website: avalanche.continualai.org # -################################################################################ - -python="3.9" -cuda_version="none" -help=false -accept_conda_prompts=false -use_mamba=false - -while test $# -gt 0; do - case "$1" in - --python) - shift - python=$1 - shift - ;; - --cuda_version) - shift - cuda_version=$1 - shift - ;; - --help) - help=true - shift - ;; - --yes) - accept_conda_prompts=true - shift - ;; - --mamba) - use_mamba=true - shift - ;; - *) - echo "$1 is not a recognized flag! Use --python and/or --cuda_version. Use --help to open the guide." - exit 1; - ;; - esac -done - -if [ "$help" = true ] ; then - echo 'Usage: bash -i ./install_environment.sh [OPTION]...' - echo 'Install the avalanche environment using conda' - echo '' - echo 'The scrip takes the following arguments:' - echo '' - echo ' --python set the python version. Can take the values [3.7, 3.8, 3.9, 3.10], default 3.9.' - echo ' --cuda_version set the cuda version. You have to check the current version of cuda installed on your system and pass it as argument. If cuda is not installed or you want to use cpu pass "none". Can take the values [9.2, 10.1, 10.2, 11.0, 11.1, 11.3, 11.6, none], default none.' - echo ' --yes automatically answer yes to conda prompts.' - echo ' --mamba use mamba instead of conda.' - echo ' --help display this help and exit.' - echo '' - echo 'Examples:' - echo ' bash -i install_environment.sh --python 3.9 --cuda_version 11.6' - echo ' bash -i install_environment.sh --cuda_version none' - exit 0 -fi - -conda_prompt="" -conda_executable="conda" -conda_channels="-c pytorch" -cuda_package="" - -if [ "$accept_conda_prompts" = true ] ; then - conda_prompt="-y" -fi - -if [ "$use_mamba" = true ] ; then - conda_executable="mamba" -fi - -if ! [[ "$python" =~ ^(3.7|3.8|3.9|3.10)$ ]]; then - echo "Select a python version between 3.7, 3.8, 3.9, 3.10" - exit 1 -fi - -if ! [[ "$cuda_version" =~ ^(9.2|10.1|10.2|11.0|11.1|11.3|11.6|"none")$ ]]; then - echo "Select a CUDA version between 9.2, 10.1, 10.2, 11.0, 11.1, 11.3, 11.6, none" - exit 1 -fi - -if [[ "$cuda_version" = "none" ]]; then - cuda_package="cpuonly" - if [[ "$python" = 3.9 || "$python" = 3.10 ]]; then - conda_channels="${conda_channels} -c=conda-forge" - fi -else - cuda_package="cudatoolkit=$cuda_version" - if [[ "$python" = 3.9 || "$python" = 3.10 || "$cuda_version" = 11.1 || "$cuda_version" = 11.6 ]]; then - conda_channels="${conda_channels} -c=conda-forge" - fi -fi - -echo "python version: $python" -echo "cuda version: $cuda_version" -echo "conda executable: $conda_executable" - -set -euox pipefail -$conda_executable create -n avalanche-env python=$python -c conda-forge $conda_prompt -set +euox pipefail -source activate avalanche-env - -set -euox pipefail -$conda_executable install pytorch torchvision $cuda_package $conda_channels $conda_prompt -$conda_executable env update --file environment.yml diff --git a/install_environment_dev.sh b/install_environment_dev.sh deleted file mode 100644 index 201316ed0..000000000 --- a/install_environment_dev.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/bash - -################################################################################ -# Copyright (c) 2021 ContinualAI. # -# Copyrights licensed under the MIT License. # -# See the accompanying LICENSE file for terms. # -# # -# Date: 09-02-2021 # -# Author(s): Gabriele Graffieti # -# E-mail: contact@continualai.org # -# Website: avalanche.continualai.org # -################################################################################ - -python="3.9" -cuda_version="none" -help=false -accept_conda_prompts=false -use_mamba=false - -while test $# -gt 0; do - case "$1" in - --python) - shift - python=$1 - shift - ;; - --cuda_version) - shift - cuda_version=$1 - shift - ;; - --help) - help=true - shift - ;; - --yes) - accept_conda_prompts=true - shift - ;; - --mamba) - use_mamba=true - shift - ;; - *) - echo "$1 is not a recognized flag! Use --python and/or --cuda_version. Use --help to open the guide." - exit 1; - ;; - esac -done - -if [ "$help" = true ] ; then - echo 'Usage: bash -i ./install_environment_dev.sh [OPTION]...' - echo 'Install the avalanche development environment using conda' - echo '' - echo 'The scrip takes the following arguments:' - echo '' - echo ' --python set the python version. Can take the values [3.7, 3.8, 3.9, 3.10], default 3.9.' - echo ' --cuda_version set the cuda version. You have to check the current version of cuda installed on your system and pass it as argument. If cuda is not installed or you want to use cpu pass "none". Can take the values [9.2, 10.1, 10.2, 11.0, 11.1, 11.3, 11.6, none], default none.' - echo ' --yes automatically answer yes to conda prompts.' - echo ' --mamba use mamba instead of conda.' - echo ' --help display this help and exit.' - echo '' - echo 'Examples:' - echo ' bash -i install_environment_dev.sh --python 3.9 --cuda_version 11.6' - echo ' bash -i install_environment_dev.sh --cuda_version none' - exit 0 -fi - -conda_prompt="" -conda_executable="conda" -conda_channels="-c pytorch" -cuda_package="" - -if [ "$accept_conda_prompts" = true ] ; then - conda_prompt="-y" -fi - -if [ "$use_mamba" = true ] ; then - conda_executable="mamba" -fi - -if ! [[ "$python" =~ ^(3.7|3.8|3.9|3.10)$ ]]; then - echo "Select a python version between 3.7, 3.8, 3.9, 3.10" - exit 1 -fi - -if ! [[ "$cuda_version" =~ ^(9.2|10.1|10.2|11.0|11.1|11.3|11.6|"none")$ ]]; then - echo "Select a CUDA version between 9.2, 10.1, 10.2, 11.0, 11.1, 11.3, 11.6, none" - exit 1 -fi - -if [[ "$cuda_version" = "none" ]]; then - cuda_package="cpuonly" - if [[ "$python" = 3.9 || "$python" = 3.10 ]]; then - conda_channels="${conda_channels} -c=conda-forge" - fi -else - cuda_package="cudatoolkit=$cuda_version" - if [[ "$python" = 3.9 || "$python" = 3.10 || "$cuda_version" = 11.1 || "$cuda_version" = 11.6 ]]; then - conda_channels="${conda_channels} -c=conda-forge" - fi -fi - -echo "python version: $python" -echo "cuda version: $cuda_version" -echo "conda executable: $conda_executable" - -set -euox pipefail -$conda_executable create -n avalanche-env python=$python -c conda-forge $conda_prompt -set +euox pipefail -source activate avalanche-env - -set -euox pipefail -$conda_executable install pytorch torchvision $cuda_package $conda_channels $conda_prompt -$conda_executable env update --file environment-dev.yml diff --git a/meta.yaml b/meta.yaml deleted file mode 100644 index bdf0f1a0b..000000000 --- a/meta.yaml +++ /dev/null @@ -1,115 +0,0 @@ -{% set name = "avalanche" %} -{% set version = load_setup_py_data().version %} - -package: - name: "{{ name|lower }}" - version: "{{ version }}" - -source: - git_url: https://github.com/vlomonaco/avalanche.git - -requirements: - build: - - python=3.8 - run: - - _libgcc_mutex=0.1=main - - absl-py=0.9.0=py38_0 - - blas=1.0=mkl - - blinker=1.4=py38_0 - - c-ares=1.15.0=h7b6447c_1001 - - ca-certificates=2020.1.1=0 - - cachetools=3.1.1=py_0 - - certifi=2020.4.5.1=py38_0 - - cffi=1.14.0=py38he30daa8_1 - - chardet=3.0.4=py38_1003 - - click=7.1.2=py_0 - - cryptography=2.9.2=py38h1ba5d50_0 - - cudatoolkit=10.2.89=hfd86e86_1 - - cycler=0.10.0=py38_0 - - dbus=1.13.14=hb2f20db_0 - - expat=2.2.6=he6710b0_0 - - fontconfig=2.13.0=h9420a91_0 - - freetype=2.9.1=h8a8886c_1 - - glib=2.63.1=h3eb4bd4_1 - - google-auth=1.14.1=py_0 - - google-auth-oauthlib=0.4.1=py_2 - - grpcio=1.27.2=py38hf8bcb03_0 - - gst-plugins-base=1.14.0=hbbd80ab_1 - - gstreamer=1.14.0=hb31296c_0 - - icu=58.2=he6710b0_3 - - idna=2.9=py_1 - - intel-openmp=2020.1=217 - - joblib=0.15.1=py_0 - - jpeg=9b=h024ee3a_2 - - kiwisolver=1.2.0=py38hfd86e86_0 - - ld_impl_linux-64=2.33.1=h53a641e_7 - - libedit=3.1.20181209=hc058e9b_0 - - libffi=3.3=he6710b0_1 - - libgcc-ng=9.1.0=hdf63c60_0 - - libgfortran-ng=7.3.0=hdf63c60_0 - - libpng=1.6.37=hbc83047_0 - - libprotobuf=3.11.4=hd408876_0 - - libstdcxx-ng=9.1.0=hdf63c60_0 - - libtiff=4.1.0=h2733197_0 - - libuuid=1.0.3=h1bed415_2 - - libxcb=1.13=h1bed415_1 - - libxml2=2.9.9=hea5a465_1 - - markdown=3.1.1=py38_0 - - matplotlib=3.1.3=py38_0 - - matplotlib-base=3.1.3=py38hef1b27d_0 - - mkl=2020.1=217 - - mkl-service=2.3.0=py38he904b0f_0 - - mkl_fft=1.0.15=py38ha843d7b_0 - - mkl_random=1.1.1=py38h0573a6f_0 - - ncurses=6.2=he6710b0_1 - - ninja=1.9.0=py38hfd86e86_0 - - numpy=1.18.1=py38h4f9e942_0 - - numpy-base=1.18.1=py38hde5b4d6_1 - - oauthlib=3.1.0=py_0 - - olefile=0.46=py_0 - - openssl=1.1.1g=h7b6447c_0 - - pcre=8.43=he6710b0_0 - - pillow=7.1.2=py38hb39fc2d_0 - - pip=20.0.2=py38_3 - - protobuf=3.11.4=py38he6710b0_0 - - psutil=5.7.0=py38h7b6447c_0 - - pyasn1=0.4.8=py_0 - - pyasn1-modules=0.2.7=py_0 - - pycparser=2.20=py_0 - - pyjwt=1.7.1=py38_0 - - pyopenssl=19.1.0=py38_0 - - pyparsing=2.4.7=py_0 - - pyqt=5.9.2=py38h05f1152_4 - - pysocks=1.7.1=py38_0 - - python=3.8.3=hcff3b4d_0 - - python-dateutil=2.8.1=py_0 - - pytorch=1.5.0=py3.8_cuda10.2.89_cudnn7.6.5_0 - - pytorchcv=0.0.58=py38h39e3cac_0 - - qt=5.9.7=h5867ecd_1 - - readline=8.0=h7b6447c_0 - - requests=2.23.0=py38_0 - - requests-oauthlib=1.3.0=py_0 - - rsa=4.0=py_0 - - scikit-learn=0.22.1=py38hd81dba3_0 - - scipy=1.4.1=py38h0b6359f_0 - - setuptools=46.4.0=py38_0 - - sip=4.19.13=py38he6710b0_0 - - six=1.14.0=py38_0 - - sqlite=3.31.1=h62c20be_1 - - tensorboard=2.2.1=pyh532a8cf_0 - - tensorboard-plugin-wit=1.6.0=py_0 - - tk=8.6.8=hbc83047_0 - - torchvision=0.6.0=py38_cu102 - - tornado=6.0.4=py38h7b6447c_1 - - urllib3=1.25.8=py38_0 - - werkzeug=1.0.1=py_0 - - wheel=0.34.2=py38_0 - - xz=5.2.5=h7b6447c_0 - - zlib=1.2.11=h7b6447c_3 - - zstd=1.3.7=h0b5b093_0 - -about: - home: https://vlomonaco.github.io/avalanche - license: MIT - license_family: MIT - summary: "Avalanche: a Comprehensive Framework for Continual Learning Research" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index b4b751b66..ee093a512 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -typing-extensions==4.4.0 +typing-extensions>=4.6.0 psutil gputil scikit-learn diff --git a/setup.cfg b/setup.cfg index 44376571b..064ef22f6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,3 +4,9 @@ ignore = W293, W291, E226, E123, E126, W504, W503, E402, E203, W605 max-line-length = 80 statistics = True format = default + +[flake8] +ignore = E203, E266, E501, W503, F403, F401 +max-line-length = 89 +max-complexity = 18 +select = B,C,E,F,W,T4,B9 \ No newline at end of file