Skip to content

ImportError: cannot import name 'Batch' from 'torchtext.data' - pytorch 1.8 and torchtext 0.9 #6362

@shrinath-suresh

Description

@shrinath-suresh

🐛 Bug

Unable to import pytorch lightning - 1.2.2 with pytorch 1.8 and torchtext 0.9.

To Reproduce

Install Pytorch 1.8 - conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
Install torchtext 0.9 - pip install torchtext
Install pytorch lightning 1.2.2 - pip install pytorch_lightning

Open python prompt and import pytorch lightning

Error log - pytorch_lightning_import_error.log attached

pytorch_lightning_import_error.log

Expected behavior

Pytorchlightning package should be imported successfully

Environment

`* CUDA:
- GPU:
- available: False
- version: 10.2

  • Packages:
    • numpy: 1.19.2
    • pyTorch_debug: False
    • pyTorch_version: 1.8.0
    • tqdm: 4.50.2
  • System:
$ pip freeze | grep light
pytorch-lightning==1.2.2

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedOpen to be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions