Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Error when importing torchtext: "No module named 'regex'" #1951

@seemethere

Description

@seemethere

We're observing errors on torchtext when attempting to import wheels due to a missing dependency.

Error looks like:

ERROR conda.cli.main_run:execute(41): `conda run python -c import torchtext; print('package version is ', torchtext.__version__)` failed. (See above for error)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/__w/_temp/conda_environment_3282699477/lib/python3.7/site-packages/torchtext/__init__.py", line 12, in <module>
    from . import data, datasets, prototype, functional, models, nn, transforms, utils, vocab, experimental
  File "/__w/_temp/conda_environment_3282699477/lib/python3.7/site-packages/torchtext/models/__init__.py", line 1, in <module>
    from .roberta import *  # noqa: F401, F403
  File "/__w/_temp/conda_environment_3282699477/lib/python3.7/site-packages/torchtext/models/roberta/__init__.py", line 1, in <module>
    from .bundler import (
  File "/__w/_temp/conda_environment_3282699477/lib/python3.7/site-packages/torchtext/models/roberta/bundler.py", line 13, in <module>
    import torchtext.transforms as T
  File "/__w/_temp/conda_environment_3282699477/lib/python3.7/site-packages/torchtext/transforms.py", line 6, in <module>
    import regex as re
ModuleNotFoundError: No module named 'regex'

Issue was introduced in #1946 and was fixed for conda but not fixed for wheels

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions