diff --git a/.circleci/config.yml b/.circleci/config.yml index c91a6973d16..f1dabc9d7a9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -200,6 +200,7 @@ jobs: pip install --user --progress-bar off mypy pip install --user --progress-bar off types-requests pip install --user --progress-bar off --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html + pip install --user --progress-bar off git+https://github.com/pytorch/data.git pip install --user --progress-bar off --editable . mypy --config-file mypy.ini diff --git a/.circleci/config.yml.in b/.circleci/config.yml.in index 77b8a1468a3..c8dd8a5cbc7 100644 --- a/.circleci/config.yml.in +++ b/.circleci/config.yml.in @@ -200,6 +200,7 @@ jobs: pip install --user --progress-bar off mypy pip install --user --progress-bar off types-requests pip install --user --progress-bar off --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html + pip install --user --progress-bar off git+https://github.com/pytorch/data.git pip install --user --progress-bar off --editable . mypy --config-file mypy.ini diff --git a/.circleci/unittest/linux/scripts/install.sh b/.circleci/unittest/linux/scripts/install.sh index e9b9e80c077..2bf3684ead1 100755 --- a/.circleci/unittest/linux/scripts/install.sh +++ b/.circleci/unittest/linux/scripts/install.sh @@ -26,6 +26,10 @@ fi printf "Installing PyTorch with %s\n" "${cudatoolkit}" conda install -y -c "pytorch-${UPLOAD_CHANNEL}" "pytorch-${UPLOAD_CHANNEL}"::pytorch "${cudatoolkit}" pytest +printf "Installing torchdata from source" +pip install git+https://github.com/pytorch/data.git + + if [ $PYTHON_VERSION == "3.6" ]; then printf "Installing minimal PILLOW version\n" # Install the minimal PILLOW version. Otherwise, let setup.py install the latest diff --git a/.circleci/unittest/windows/scripts/install.sh b/.circleci/unittest/windows/scripts/install.sh index e4756179371..49ef8224b59 100644 --- a/.circleci/unittest/windows/scripts/install.sh +++ b/.circleci/unittest/windows/scripts/install.sh @@ -29,6 +29,10 @@ printf "Installing PyTorch with %s\n" "${cudatoolkit}" # conda-forge channel is required for cudatoolkit 11.1 on Windows, see https://github.com/pytorch/vision/issues/4458 conda install -y -c "pytorch-${UPLOAD_CHANNEL}" -c conda-forge "pytorch-${UPLOAD_CHANNEL}"::pytorch "${cudatoolkit}" pytest +printf "Installing torchdata from source" +pip install git+https://github.com/pytorch/data.git + + if [ $PYTHON_VERSION == "3.6" ]; then printf "Installing minimal PILLOW version\n" # Install the minimal PILLOW version. Otherwise, let setup.py install the latest diff --git a/mypy.ini b/mypy.ini index de04d6d173e..dac60e11ce0 100644 --- a/mypy.ini +++ b/mypy.ini @@ -67,3 +67,7 @@ ignore_missing_imports = True [mypy-defusedxml.*] ignore_missing_imports = True + +[mypy-torchdata.*] + +ignore_missing_imports = True diff --git a/torchvision/prototype/datasets/__init__.py b/torchvision/prototype/datasets/__init__.py index 8661eb65cc5..6fa4d8dbc8f 100644 --- a/torchvision/prototype/datasets/__init__.py +++ b/torchvision/prototype/datasets/__init__.py @@ -1,3 +1,13 @@ +try: + import torchdata +except (ModuleNotFoundError, TypeError) as error: + raise ModuleNotFoundError( + "`torchvision.prototype.datasets` depends on PyTorch's `torchdata` (https://github.com/pytorch/data). " + "You can install it with `pip install git+https://github.com/pytorch/data.git`. " + "Note that you cannot install it with `pip install torchdata`, since this is another package." + ) from error + + from ._home import home from . import decoder, utils