From a919929d405fb682bd752ac4535c2cb4fad166b7 Mon Sep 17 00:00:00 2001 From: Max Balandat Date: Thu, 7 Nov 2024 12:01:25 -0800 Subject: [PATCH] Remove support for anaconda (official package) (#2617) Summary: See https://github.com/pytorch/botorch/discussions/2613 for details. An anaconda package will still be a conda package available on the `c conda-forge`channel for those users who need it. Pull Request resolved: https://github.com/pytorch/botorch/pull/2617 Reviewed By: saitcakmak, esantorella Differential Revision: D65603328 Pulled By: Balandat fbshipit-source-id: 973086a49b51daf07718060d64893c44e3483dee --- .conda/build_conda.sh | 14 ------ .conda/meta.yaml | 50 ------------------- .github/workflows/deploy_on_release.yml | 42 ++-------------- .github/workflows/nightly.yml | 34 +------------ ...eusable_test_pip.yml => reusable_test.yml} | 6 +-- .github/workflows/test.yml | 40 ++------------- .github/workflows/test_stable.yml | 40 ++------------- README.md | 34 ++++--------- docs/getting_started.md | 14 +++--- environment.yml | 12 ----- scripts/build_and_verify_conda_package.sh | 38 -------------- scripts/versions.js | 2 +- setup.cfg | 2 +- setup.py | 1 - website/pages/en/index.js | 6 +-- 15 files changed, 38 insertions(+), 297 deletions(-) delete mode 100755 .conda/build_conda.sh delete mode 100644 .conda/meta.yaml rename .github/workflows/{reusable_test_pip.yml => reusable_test.yml} (92%) delete mode 100644 environment.yml delete mode 100755 scripts/build_and_verify_conda_package.sh diff --git a/.conda/build_conda.sh b/.conda/build_conda.sh deleted file mode 100755 index d00922e4bb..0000000000 --- a/.conda/build_conda.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -# we cannot use relative paths here, since setuptools_scm options in -# pyproject.toml cannot dynamically determine the root dir -cd .. || exit -BOTORCH_VERSION="$(python -m setuptools_scm)" -export BOTORCH_VERSION -cd .conda || exit - -conda build . diff --git a/.conda/meta.yaml b/.conda/meta.yaml deleted file mode 100644 index a8c0e68baf..0000000000 --- a/.conda/meta.yaml +++ /dev/null @@ -1,50 +0,0 @@ -{% set data = load_setup_py_data(setup_file="../setup.py", from_recipe_dir=True) %} - -package: - name: {{ data.get("name")|lower }} - version: {{ data.get("version", environ["BOTORCH_VERSION"]) }} - -source: - path: .. - -build: - noarch: python - script: "$PYTHON setup.py install --single-version-externally-managed --record=record.txt" - -requirements: - host: - - python>=3.10 - - setuptools - - setuptools_scm - run: - - pytorch >=2.0.1 - - gpytorch ==1.13 - - linear_operator ==0.5.3 - - scipy - - multipledispatch - - pyro-ppl >=1.8.4 - -test: - imports: - - botorch - - botorch.acquisition - - botorch.exceptions - - botorch.generation - - botorch.models - - botorch.optim - - botorch.posteriors - - botorch.sampling - - botorch.test_functions - - botorch.utils - - botorch.cross_validation - - botorch.fit - - botorch.logging - - botorch.settings - -about: - home: https://botorch.org - license: MIT - license_file: LICENSE - summary: Bayesian Optimization in PyTorch - doc_url: https://botorch.org/docs/introduction - dev_url: https://github.com/pytorch/botorch diff --git a/.github/workflows/deploy_on_release.yml b/.github/workflows/deploy_on_release.yml index 69cbc68c14..26f712956a 100644 --- a/.github/workflows/deploy_on_release.yml +++ b/.github/workflows/deploy_on_release.yml @@ -8,9 +8,9 @@ on: jobs: - tests-and-coverage-pip: + tests-and-coverage: name: Test & Coverage - uses: ./.github/workflows/reusable_test_pip.yml + uses: ./.github/workflows/reusable_test.yml with: use_latest_pytorch_gpytorch: false secrets: inherit @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest permissions: id-token: write # This is required for PyPI OIDC authentication. - needs: tests-and-coverage-pip + needs: tests-and-coverage steps: - uses: actions/checkout@v4 - name: Fetch all history for all tags and branches @@ -44,43 +44,9 @@ jobs: with: verbose: true - package-deploy-conda: - name: Package conda and deploy to anaconda.org - runs-on: 8-core-ubuntu - needs: tests-and-coverage-pip - steps: - - uses: actions/checkout@v4 - - uses: conda-incubator/setup-miniconda@v3 - with: - miniconda-version: "latest" - activate-environment: test - python-version: "3.10" - - name: Fetch all history for all tags and branches - run: git fetch --prune --unshallow - - name: Install dependencies - shell: bash -l {0} - run: | - conda install -y setuptools_scm conda-build conda-verify anaconda-client - conda install -y scipy sphinx pytest flake8 multipledispatch - conda install -y -c pytorch pytorch cpuonly - conda install -y -c gpytorch gpytorch - conda install -y -c conda-forge pyro-ppl>=1.8.4 - conda config --set anaconda_upload no - - name: Build and verify conda package - shell: bash -l {0} - run: | - ./scripts/build_and_verify_conda_package.sh - - name: Deploy to anaconda.org - shell: bash -l {0} - run: | - botorch_version=$(python -m setuptools_scm) - build_dir="$(pwd)/.conda/conda_build/noarch" - pkg_file="${build_dir}/botorch-${botorch_version}-0.tar.bz2" - anaconda -t ${{ secrets.ANACONDA_UPLOAD_TOKEN }} upload -u pytorch $pkg_file - publish-versioned-website: name: Publish versioned website - needs: [package-deploy-pypi, package-deploy-conda] + needs: package-deploy-pypi uses: ./.github/workflows/reusable_website.yml with: publish_versioned_website: true diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 131e164da7..91a110467d 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -10,7 +10,7 @@ on: jobs: tests-and-coverage-nightly: name: Test & Coverage - uses: ./.github/workflows/reusable_test_pip.yml + uses: ./.github/workflows/reusable_test.yml with: use_latest_pytorch_gpytorch: true secrets: inherit @@ -60,39 +60,9 @@ jobs: skip-existing: true verbose: true - package-conda: - name: Test conda build - runs-on: 8-core-ubuntu - steps: - - uses: actions/checkout@v4 - - uses: conda-incubator/setup-miniconda@v3 - with: - miniconda-version: "latest" - activate-environment: test - python-version: "3.10" - - name: Fetch all history for all tags and branches - run: git fetch --prune --unshallow - - name: Install dependencies - shell: bash -l {0} - env: - ALLOW_LATEST_GPYTORCH_LINOP: true - # Don't need most deps for conda build, but need them for testing - # We do need setuptools_scm though to properly parse the version - run: | - conda install -y scipy multipledispatch setuptools_scm conda-build conda-verify - conda config --set anaconda_upload no - conda install -y -c pytorch-nightly pytorch cpuonly - conda install -y -c conda-forge pyro-ppl>=1.8.4 - pip install git+https://github.com/cornellius-gp/linear_operator.git - pip install git+https://github.com/cornellius-gp/gpytorch.git - - name: Build and verify conda package - shell: bash -l {0} - run: | - ./scripts/build_and_verify_conda_package.sh - publish-latest-website: name: Publish latest website - needs: [tests-and-coverage-nightly, package-test-deploy-pypi, package-conda] + needs: [tests-and-coverage-nightly, package-test-deploy-pypi] uses: ./.github/workflows/reusable_website.yml with: publish_versioned_website: false diff --git a/.github/workflows/reusable_test_pip.yml b/.github/workflows/reusable_test.yml similarity index 92% rename from .github/workflows/reusable_test_pip.yml rename to .github/workflows/reusable_test.yml index accc6cbb28..32a6b3d148 100644 --- a/.github/workflows/reusable_test_pip.yml +++ b/.github/workflows/reusable_test.yml @@ -1,4 +1,4 @@ -name: Reusable Test Workflow w/ pip +name: Reusable Test Workflow on: workflow_call: @@ -13,8 +13,8 @@ on: jobs: - tests-and-coverage-pip: - name: Tests and coverage (pip, Python ${{ matrix.python-version }}, ${{ matrix.os }}) + tests-and-coverage: + name: Tests and coverage (Python ${{ matrix.python-version }}, ${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f9475f1314..aa910d8612 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,43 +9,9 @@ on: jobs: - tests-and-coverage-pip: - name: Test & Coverage (pip) - uses: ./.github/workflows/reusable_test_pip.yml + tests-and-coverage: + name: Test & Coverage + uses: ./.github/workflows/reusable_test.yml with: use_latest_pytorch_gpytorch: true secrets: inherit - - tests-conda: - name: Tests (conda, ${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: ["ubuntu-latest", "macos-14", "windows-latest"] - python-version: ["3.10", "3.12"] - steps: - - uses: actions/checkout@v4 - - uses: conda-incubator/setup-miniconda@v3 - with: - miniconda-version: "latest" - activate-environment: test - python-version: ${{ matrix.python-version }} - - name: Install dependencies - shell: bash -l {0} - env: - ALLOW_LATEST_GPYTORCH_LINOP: true - run: | - conda install pytorch torchvision -c pytorch - conda install -y pip scipy sphinx pytest flake8 - pip install git+https://github.com/cornellius-gp/linear_operator.git - pip install git+https://github.com/cornellius-gp/gpytorch.git - pip install .[test] - - name: Unit tests -- BoTorch - shell: bash -l {0} - run: | - pytest -ra test/ - - name: Unit tests -- BoTorch Community - shell: bash -l {0} - run: | - pytest -ra test_community/ diff --git a/.github/workflows/test_stable.yml b/.github/workflows/test_stable.yml index ba14c37ed9..6bda18c640 100644 --- a/.github/workflows/test_stable.yml +++ b/.github/workflows/test_stable.yml @@ -5,48 +5,16 @@ on: jobs: - tests-and-coverage-pip-stable: + tests-and-coverage-stable: name: Test & Coverage - uses: ./.github/workflows/reusable_test_pip.yml + uses: ./.github/workflows/reusable_test.yml with: use_latest_pytorch_gpytorch: false upload_coverage: false secrets: inherit - tests-conda-stable: - name: Tests (conda, ${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: ["ubuntu-latest", "macos-14", "windows-latest"] - python-version: ["3.10", "3.12"] - steps: - - uses: actions/checkout@v4 - - uses: conda-incubator/setup-miniconda@v3 - with: - miniconda-version: "latest" - activate-environment: test - python-version: ${{ matrix.python-version }} - - name: Install dependencies - shell: bash -l {0} - run: | - conda install -y -c pytorch pytorch cpuonly - conda install -y pip scipy pytest - conda install -y -c gpytorch gpytorch - conda install -y -c conda-forge pyro-ppl>=1.8.4 - pip install .[test] - - name: Unit tests and coverage -- BoTorch - shell: bash -l {0} - run: | - pytest -ra test/ --cov botorch/ --cov-report term-missing --cov-report xml:botorch_cov.xml - - name: Unit tests and coverage -- BoTorch Community - shell: bash -l {0} - run: | - pytest -ra test_community/ --cov botorch_community/ --cov-report term-missing --cov-report xml:botorch_community_cov.xml - - tests-and-coverage-min-req-pip: - name: Tests and coverage min req. torch, gpytorch & linear_operator versions (pip, Python ${{ matrix.python-version }}, ${{ matrix.os }}) + tests-and-coverage-min-req: + name: Tests and coverage min req. torch, gpytorch & linear_operator versions (Python ${{ matrix.python-version }}, ${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false diff --git a/README.md b/README.md index d10fa94c66..b8420ff4b3 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ [![Nightly](https://github.com/pytorch/botorch/actions/workflows/nightly.yml/badge.svg)](https://github.com/pytorch/botorch/actions?query=workflow%3ANightly) [![Codecov](https://img.shields.io/codecov/c/github/pytorch/botorch.svg)](https://codecov.io/github/pytorch/botorch) -[![Conda](https://img.shields.io/conda/v/pytorch/botorch.svg)](https://anaconda.org/pytorch/botorch) [![PyPI](https://img.shields.io/pypi/v/botorch.svg)](https://pypi.org/project/botorch) [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) @@ -63,39 +62,26 @@ Optimization simply use Ax. - scipy - multiple-dispatch -### Prerequisite only for MacOS users with Intel processors: -Before installing BoTorch, we recommend first manually installing PyTorch, a required dependency of -BoTorch. Installing it according to the [PyTorch installation instructions](https://pytorch.org/get-started/locally/) -ensures that it is properly linked against MKL, a library that optimizes mathematical computation for Intel processors. -This will result in up to an order-of-magnitude speed-up for Bayesian optimization, as at the moment, -installing PyTorch from pip does not link against MKL. - -The PyTorch installation instructions currently recommend: -1. Install [Anaconda](https://www.anaconda.com/distribution/#download-section). Note that there are different installers for Intel and M1 Macs. -2. Install PyTorch following the [PyTorch installation instructions](https://pytorch.org/get-started/locally/). -Currently, this suggests running `conda install pytorch torchvision -c pytorch`. - -If you want to customize your installation, please follow the [PyTorch installation instructions](https://pytorch.org/get-started/locally/) to build from source. ### Option 1: Installing the latest release -The latest release of BoTorch is easily installed either via -[Anaconda](https://www.anaconda.com/distribution/#download-section) (recommended) or pip. +The latest release of BoTorch is easily installed via `pip`: -**To install BoTorch from Anaconda**, run ```bash -conda install botorch -c pytorch -c gpytorch -c conda-forge +pip install botorch ``` -The above command installs BoTorch and any needed dependencies. ` -c pytorch -c gpytorch -c conda-forge` means that the most preferred source to install from is the PyTorch channel, the next most preferred is the GPyTorch channel, -and the least preferred is conda-forge. -**Alternatively, to install with `pip`**, do +_Note_: Make sure the `pip` being used is actually the one from the newly created +Conda environment. If you're using a Unix-based OS, you can use `which pip` to check. + +BoTorch [stopped publishing](https://github.com/pytorch/botorch/discussions/2613#discussion-7431533) +an official Anaconda package to the `pytorch` channel after the 0.12 release. However, +users can still use the package published to the `conda-forge` channel and install botorch via + ```bash -pip install botorch +conda install botorch -c gpytorch -c conda-forge ``` -_Note_: Make sure the `pip` being used is actually the one from the newly created Conda environment. If you're using a Unix-based OS, you can use `which pip` to check. - ### Option 2: Installing from latest main branch If you would like to try our bleeding edge features (and don't mind potentially diff --git a/docs/getting_started.md b/docs/getting_started.md index 44677967f6..a17f0f5e02 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -13,19 +13,19 @@ Before jumping the gun, we recommend you start with the high-level #### Installation Requirements: -BoTorch is easily installed via -[Anaconda](https://www.anaconda.com/distribution/#download-section) (strongly recommended for OSX) -or `pip`: +BoTorch is easily installed via `pip` (recommended). It is also possible to +use the (unofficial) [Anaconda](https://www.anaconda.com/distribution/#download-section) +package from the `-c conda-forge` channel. - -```bash -conda install botorch -c pytorch -c gpytorch -c conda-forge -``` ```bash pip install botorch ``` + +```bash +conda install botorch -c gpytorch -c conda-forge +``` For more installation options and detailed instructions, please see the diff --git a/environment.yml b/environment.yml deleted file mode 100644 index 9957bcd731..0000000000 --- a/environment.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: botorch -channels: - - pytorch - - gpytorch - - conda-forge -dependencies: - - pytorch>=2.0.1 - - gpytorch==1.13 - - linear_operator==0.5.3 - - scipy - - multipledispatch - - pyro-ppl>=1.8.4 diff --git a/scripts/build_and_verify_conda_package.sh b/scripts/build_and_verify_conda_package.sh deleted file mode 100755 index 913b19d010..0000000000 --- a/scripts/build_and_verify_conda_package.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -# Get version number (created dynamically via setuptools-scm) -BOTORCH_VERSION=$(python -m setuptools_scm) -if [[ $? != "0" ]]; then - echo "Determining version via setuptools_scm failed." - echo "Make sure that setuptools_scm is installed in your python environment." - exit 1 -fi -# Export env var (this is used in .conda/meta.yaml) -export BOTORCH_VERSION - -cd .conda || exit - -# build package -cur_dir="$(pwd)" -build_dir="${cur_dir}/conda_build" -mkdir "${build_dir}" -conda build -c pytorch -c gpytorch -c conda-forge --output-folder "${build_dir}" . - -# name of package file (assuming first build) -path="${build_dir}/noarch/botorch-${BOTORCH_VERSION}-0.tar.bz2" - -# verify that package installs correctly -conda install --offline "${path}" - -# verify import works and version is correct -conda_version=$(python -c "import botorch; print(botorch.__version__)" | tail -n 1) -if [[ $conda_version != "$BOTORCH_VERSION" ]]; then - echo "Incorrect version. Expected: ${BOTORCH_VERSION}, Actual: ${conda_version}" - exit 1 -fi - -cd .. || exit diff --git a/scripts/versions.js b/scripts/versions.js index 26f7d30a45..fec766ccc8 100644 --- a/scripts/versions.js +++ b/scripts/versions.js @@ -51,7 +51,7 @@ function Versions(props) { {`stable (${latestVersion})`} - conda install botorch -c pytorch -c gpytorch + pip install botorch stable diff --git a/setup.cfg b/setup.cfg index 3513eb4d33..b1caaccd2c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,7 +10,7 @@ ignore = E203, E701, W503, D extend-select = D107, D417, D3, D207, D208, D214, D215 max-line-length = 88 exclude = - build, dist, tutorials, website, .conda, .eggs + build, dist, tutorials, website, .eggs [coverage:report] omit = diff --git a/setup.py b/setup.py index fb06d97d5c..506bca41dc 100644 --- a/setup.py +++ b/setup.py @@ -85,7 +85,6 @@ def read_deps_from_file(filname): project_urls={ "Documentation": "https://botorch.org", "Source": "https://github.com/pytorch/botorch", - "conda": "https://anaconda.org/pytorch/botorch", }, keywords=["Bayesian optimization", "PyTorch"], classifiers=[ diff --git a/website/pages/en/index.js b/website/pages/en/index.js index 83f1d6263e..9d7e5d151f 100755 --- a/website/pages/en/index.js +++ b/website/pages/en/index.js @@ -168,10 +168,10 @@ candidate # tensor([[0.2981, 0.2401]], dtype=torch.float64)
  1. Install BoTorch:

    - via Conda (strongly recommended for OSX): - {bash`conda install botorch -c pytorch -c gpytorch -c conda-forge`} - via pip: + via pip (recommended): {bash`pip install botorch`} + via Anaconda (from the unofficial conda-forge channel): + {bash`conda install botorch -c gpytorch -c conda-forge`}
  2. Fit a model: