Skip to content

Commit ad6795b

Browse files
Vivek Miglanifacebook-github-bot
Vivek Miglani
authored andcommitted
Update minimum Python version for Captum to 3.9 (#1460)
Summary: Pull Request resolved: #1460 Python 3.8 has reached EOL in Oct 2024, so we can upgrade minimum python required for Captum to 3.9. We are seeing test failures due to dependencies when running with Python 3.8, so upgrading minimum version to resolve these. Also removing nightly install for conda script, since nightly builds are no longer published through conda. Reviewed By: cyrjano, sarahtranfb Differential Revision: D67545940 fbshipit-source-id: 692b72044fafd0e8176b365a60523a9d692b567d
1 parent 2b9f4ae commit ad6795b

File tree

7 files changed

+24
-23
lines changed

7 files changed

+24
-23
lines changed

.conda/meta.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ build:
1313

1414
requirements:
1515
host:
16-
- python>=3.8
16+
- python>=3.9
1717
run:
1818
- numpy<2.0
1919
- pytorch>=1.10

.github/workflows/test-conda-cpu.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
tests:
1616
strategy:
1717
matrix:
18-
python_version: ["3.8", "3.9", "3.10", "3.11"]
18+
python_version: ["3.9", "3.10", "3.11", "3.12"]
1919
fail-fast: false
2020
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
2121
with:
@@ -28,7 +28,7 @@ jobs:
2828
# Create Conda Env
2929
conda create -yp ci_env python="${PYTHON_VERSION}"
3030
conda activate /pytorch/captum/ci_env
31-
./scripts/install_via_conda.sh -n
31+
./scripts/install_via_conda.sh
3232
3333
# Run Tests
3434
python3 -m pytest -ra --cov=. --cov-report term-missing

.github/workflows/test-pip-cpu.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
matrix:
1515
pytorch_args: ["-v 1.10", "-v 1.11", "-v 1.12", "-v 1.13", "-v 2.0.0", "-v 2.1.0", "-v 2.2.0", "-v 2.3.0"]
1616
transformers_args: ["-t 4.38.0", "-t 4.39.0", "-t 4.41.0", "-t 4.43.0", "-t 4.45.2"]
17-
docker_img: ["cimg/python:3.8", "cimg/python:3.9", "cimg/python:3.10", "cimg/python:3.11"]
17+
docker_img: ["cimg/python:3.9", "cimg/python:3.10", "cimg/python:3.11", "cimg/python:3.12"]
1818
exclude:
1919
- pytorch_args: "-v 1.10"
2020
docker_img: "cimg/python:3.10"
@@ -24,6 +24,18 @@ jobs:
2424
docker_img: "cimg/python:3.11"
2525
- pytorch_args: "-v 1.12"
2626
docker_img: "cimg/python:3.11"
27+
- pytorch_args: "-v 1.10"
28+
docker_img: "cimg/python:3.12"
29+
- pytorch_args: "-v 1.11"
30+
docker_img: "cimg/python:3.12"
31+
- pytorch_args: "-v 1.12"
32+
docker_img: "cimg/python:3.12"
33+
- pytorch_args: "-v 1.13"
34+
docker_img: "cimg/python:3.12"
35+
- pytorch_args: "-v 2.0.0"
36+
docker_img: "cimg/python:3.12"
37+
- pytorch_args: "-v 2.1.0"
38+
docker_img: "cimg/python:3.12"
2739
fail-fast: false
2840
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
2941
with:

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Then run this script from the repository root:
6363
```
6464
Note that we expect mypy to have version 0.760 or higher, and when type checking, use PyTorch 1.4 or
6565
higher due to fixes to PyTorch type hints available in 1.4. We also use the Literal feature which is
66-
available only in Python 3.8 or above. If type-checking using a previous version of Python, you will
66+
available only in Python 3.9 or above. If type-checking using a previous version of Python, you will
6767
need to install the typing-extension package which can be done with pip using `pip install typing-extensions`.
6868

6969
#### Unit Tests

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Captum can also be used by application engineers who are using trained models in
4747
## Installation
4848

4949
**Installation Requirements**
50-
- Python >= 3.8
50+
- Python >= 3.9
5151
- PyTorch >= 1.10
5252

5353

scripts/install_via_conda.sh

+4-15
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22

33
set -e
44

5-
PYTORCH_NIGHTLY=false
6-
75
while getopts 'nf' flag; do
86
case "${flag}" in
9-
n) PYTORCH_NIGHTLY=true ;;
107
f) FRAMEWORKS=true ;;
118
*) echo "usage: $0 [-n] [-f]" >&2
129
exit 1 ;;
@@ -18,25 +15,17 @@ while getopts 'nf' flag; do
1815
#conda update -y -n base -c defaults conda
1916
conda update -q --all --yes
2017

21-
# required to use conda develop
22-
conda install -q -y conda-build
23-
2418
# install other frameworks if asked for and make sure this is before pytorch
2519
if [[ $FRAMEWORKS == true ]]; then
2620
pip install -q pytext-nlp
2721
fi
2822

29-
if [[ $PYTORCH_NIGHTLY == true ]]; then
30-
# install CPU version for much smaller download
31-
conda install -q -y pytorch cpuonly -c pytorch-nightly
32-
else
33-
# install CPU version for much smaller download
34-
conda install -q -y -c pytorch pytorch-cpu
35-
fi
23+
# install CPU version for much smaller download
24+
conda install -q -y pytorch cpuonly -c pytorch
3625

3726
# install other deps
38-
conda install -q -y pytest ipywidgets ipython scikit-learn parameterized werkzeug==2.2.2
39-
conda install -q -y -c conda-forge matplotlib pytest-cov flask flask-compress
27+
conda install -q -y pytest ipywidgets ipython scikit-learn parameterized werkzeug
28+
conda install -q -y -c conda-forge matplotlib pytest-cov flask flask-compress conda-build
4029
conda install -q -y transformers
4130

4231
# install captum

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from setuptools import find_packages, setup
1717

1818
REQUIRED_MAJOR = 3
19-
REQUIRED_MINOR = 8
19+
REQUIRED_MINOR = 9
2020

2121
# Check for python version
2222
if sys.version_info < (REQUIRED_MAJOR, REQUIRED_MINOR):
@@ -148,7 +148,7 @@ def get_package_files(root, subdirs):
148148
],
149149
long_description=long_description,
150150
long_description_content_type="text/markdown",
151-
python_requires=">=3.8",
151+
python_requires=">=3.9",
152152
install_requires=[
153153
"matplotlib",
154154
"numpy<2.0",

0 commit comments

Comments
 (0)