Skip to content

TorchData CI for 3.14 can't find module packaging (called from torch/_native/cutedsl_utils.py) #1539

@divyanshk

Description

@divyanshk

I see this error in torchdata ci for nightly / validate-binaries / linux-manywheel-3.14-cpu / linux-manywheel-3.14-cpu and nightly / validate-binaries / windows-wheel-3.14-cpu / windows-wheel-3.14-cpu

+++ python ./test/smoke_test/smoke_test.py
/opt/conda/envs/conda-env-23955895397/lib/python3.14/site-packages/torch/_subclasses/functional_tensor.py:307: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at /pytorch/torch/csrc/utils/tensor_numpy.cpp:84.)
  cpu = _conversion_method_template(device=torch.device("cpu"))
Traceback (most recent call last):
  File "/meta-pytorch/data/./test/smoke_test/smoke_test.py", line 18, in <module>
    stateful_dataloader_test()
    ~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/meta-pytorch/data/./test/smoke_test/smoke_test.py", line 9, in stateful_dataloader_test
    from torchdata.nodes import Loader
  File "/opt/conda/envs/conda-env-23955895397/lib/python3.14/site-packages/torchdata/nodes/__init__.py", line 7, in <module>
    from .adapters import IterableWrapper, MapStyleWrapper, SamplerWrapper
  File "/opt/conda/envs/conda-env-23955895397/lib/python3.14/site-packages/torchdata/nodes/adapters.py", line 10, in <module>
    from torch.utils.data import Sampler
  File "/opt/conda/envs/conda-env-23955895397/lib/python3.14/site-packages/torch/__init__.py", line 3022, in <module>
    import torch._native
  File "/opt/conda/envs/conda-env-23955895397/lib/python3.14/site-packages/torch/_native/__init__.py", line 8, in <module>
    from . import cutedsl_utils, ops, registry, triton_utils
  File "/opt/conda/envs/conda-env-23955895397/lib/python3.14/site-packages/torch/_native/cutedsl_utils.py", line 6, in <module>
    from packaging.version import Version
ModuleNotFoundError: No module named 'packaging'

This might be related to pytorch/pytorch#178381 which landed yday. It makes torch._native.__init__ unconditionally imports cutedsl_utils, triton_utils, and common_utils, all of which do top-level imports from packaging:

torch/_native/cutedsl_utils.py → from packaging.version import Version
torch/_native/triton_utils.py → from packaging.version import Version
torch/_native/common_utils.py → import packaging.version

This works for 3.13, but maybe something changed for 3.14.

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