Repository: Unbabel/COMET
Issue: ImportError: cannot import name 'StreamWrapper' from 'torch.utils.data.datapipes.utils.common'
Root cause: External Dependency Breakage

## ImportError: cannot import name 'StreamWrapper' from 'torch.utils.data.datapipes.utils.common'


#### Code

!comet-compare   -s source.txt   -x sys1.txt   -y sys2.txt   -r ref.txt


#### Environment

Google Colab


#### Error Message

Traceback (most recent call last):
  File "/usr/local/bin/comet-compare", line 5, in <module>
    from comet.cli.compare import compare_command
  File "/usr/local/lib/python3.7/dist-packages/comet/__init__.py", line 19, in <module>
    from .download_utils import download_model
  File "/usr/local/lib/python3.7/dist-packages/comet/download_utils.py", line 26, in <module>
    from comet.models import available_metrics
  File "/usr/local/lib/python3.7/dist-packages/comet/models/__init__.py", line 17, in <module>
    from .regression.regression_metric import RegressionMetric
  File "/usr/local/lib/python3.7/dist-packages/comet/models/regression/regression_metric.py", line 26, in <module>
    from comet.models.base import CometModel
  File "/usr/local/lib/python3.7/dist-packages/comet/models/base.py", line 28, in <module>
    import pytorch_lightning as ptl
  File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/__init__.py", line 30, in <module>
    from pytorch_lightning.callbacks import Callback  # noqa: E402
  File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/callbacks/__init__.py", line 14, in <module>
    from pytorch_lightning.callbacks.base import Callback
  File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/callbacks/base.py", line 25, in <module>
    from pytorch_lightning.utilities.types import STEP_OUTPUT
  File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/__init__.py", line 18, in <module>
    from pytorch_lightning.utilities.apply_func import move_data_to_device  # noqa: F401
  File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/apply_func.py", line 29, in <module>
    from pytorch_lightning.utilities.imports import _compare_version, _TORCHTEXT_LEGACY
  File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/imports.py", line 116, in <module>
    _TORCHTEXT_LEGACY: bool = _TORCHTEXT_AVAILABLE and _compare_version("torchtext", operator.lt, "0.11.0")
  File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/imports.py", line 69, in _compare_version
    pkg = importlib.import_module(package)
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/local/lib/python3.7/dist-packages/torchtext/__init__.py", line 7, in <module>
    from . import datasets
  File "/usr/local/lib/python3.7/dist-packages/torchtext/datasets/__init__.py", line 3, in <module>
    from .ag_news import AG_NEWS
  File "/usr/local/lib/python3.7/dist-packages/torchtext/datasets/ag_news.py", line 5, in <module>
    from torchtext.data.datasets_utils import (
  File "/usr/local/lib/python3.7/dist-packages/torchtext/data/datasets_utils.py", line 12, in <module>
    from torch.utils.data.datapipes.utils.common import StreamWrapper
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)



I have the same problem when trying to use COMET from Google Colab.
This issue might need to be labeled as a bug instead of a question?

**Code**
```
!pip install --upgrade pip
!pip install unbabel-comet
import comet
```

**Environment**

Google Colab, Python 3.7.13

**Error Message**

```
ImportError                               Traceback (most recent call last)

[<ipython-input-3-569c744f4c26>](https://localhost:8080/#) in <module>()
----> 1 import comet

16 frames

[/usr/local/lib/python3.7/dist-packages/torchtext/data/datasets_utils.py](https://localhost:8080/#) 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)
```



Hi @LahiLuk. Actually, it is not a bug. I've found the problem. Google Colab has torchvision 0.12.0 and torchtext 0.12.0; they require torch==1.11.0. But COMET uses torch==1.10.0 which is incompatible. The solution is to reinstall the compatible versions with:

!pip install torchvision==0.11.1
!pip install torchtext==0.11.0