Skip to content
1 change: 1 addition & 0 deletions .circleci/config.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .circleci/config.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions .circleci/unittest/linux/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions .circleci/unittest/windows/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,7 @@ ignore_missing_imports = True
[mypy-defusedxml.*]

ignore_missing_imports = True

[mypy-torchdata.*]

ignore_missing_imports = True
10 changes: 10 additions & 0 deletions torchvision/prototype/datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
try:
import torchdata
except (ModuleNotFoundError, TypeError) as error:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The torchdata library hosted on PyPI fails for me at import with an TypeError. This is why we can aggregate both failure cases here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chatted with @pmeier , this is a bug in the torchdata from PyPI (which is unrelated to the torchdata we are depending on.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do pip install torchdata, python -c "import torchdata" fails with

TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

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

Expand Down