autogluon: [BUG] AutoGluon basic installation failing on Google Collab

  • [ X] and/or I have checked that this bug exists on the latest mainline of AutoGluon via source installation

Steps to reproduce: Start collab notebook with GPU, then:

!pip3 install -U pip !pip3 install -U setuptools wheel !pip3 install autogluon

after installation, try to import TextPredictor: from autogluon.text import TextPredictor

the result is an ImportError:

`ImportError Traceback (most recent call last) <ipython-input-2-773ba8fa46a4> in <module>() ----> 1 from autogluon.text import TextPredictor

15 frames /usr/local/lib/python3.7/dist-packages/torchtext/data/datasets_utils.py in <module>() 10 ) 11 from torch.utils.data import functional_datapipe, IterDataPipe —> 12 from torch.utils.data.datapipes.utils.common import StreamWrapper 13 import codecs 14 try:

ImportError: cannot import name ‘StreamWrapper’ from ‘torch.utils.data.datapipes.utils.common’ (/usr/local/lib/python3.7/dist-packages/torch/utils/data/datapipes/utils/common.py)

---------------------------------------------------------------------------`

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 23 (3 by maintainers)

Most upvoted comments

Did some dig into this issue:

The fundamental issue is that a fresh colab gpu env has torch==1.11 and torchtext==0.12.0. The installation of autogluon only updates torch to 1.10.2 while torchtext remains to be 0.12.0 because torchtext is not part of our dependency. However, the fact that torchtext exists made pytorch_lightning, which is our dependency, to do a version check: https://github.com/PyTorchLightning/pytorch-lightning/blob/master/pytorch_lightning/utilities/imports.py#L120-L121. So _compare_version actually imports torchtext and torchtext==0.12.0 is not compatible with torch==1.10.2 because the import from torch.utils.data.datapipes.utils.common import StreamWrapper is not available.

@rxjx @greenersharp I investigated again and feel that the root cause is pip3 install -U pip.

I tried the following and it will work without any issues. I guess we should not upgrade pip and just rely on the pip in Colab for doing installation:

!pip3 install autogluon.core
!pip3 install autogluon.features
!pip3 install autogluon.text

If that’s the case, this is not actually a bug but it’s due to inappropriate usage of Colab.