Bug 2333960 - torchvision needs to be rebuilt against NumPy 2.x
Summary: torchvision needs to be rebuilt against NumPy 2.x
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-torchvision
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Tom.Rix
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: NUMPY2
TreeView+ depends on / blocked
 
Reported: 2024-12-24 10:03 UTC by Sandro
Modified: 2024-12-24 20:40 UTC (History)
1 user (show)

Fixed In Version: python-torchvision-0.20.1-2.fc42
Clone Of:
Environment:
Last Closed: 2024-12-24 20:40:50 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Sandro 2024-12-24 10:03:14 UTC
Currently, importing torchvision results in:

>>> import torchvision

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.2.1 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/lib64/python3.13/_pyrepl/__main__.py", line 6, in <module>
    __pyrepl_interactive_console()
  File "/usr/lib64/python3.13/_pyrepl/main.py", line 59, in interactive_console
    run_multiline_interactive_console(console)
  File "/usr/lib64/python3.13/_pyrepl/simple_interact.py", line 160, in run_multiline_interactive_console
    more = console.push(_strip_final_indent(statement), filename=input_name, _symbol="single")  # type: ignore[call-arg]
  File "/usr/lib64/python3.13/code.py", line 314, in push
    more = self.runsource(source, filename, symbol=_symbol)
  File "/usr/lib64/python3.13/_pyrepl/console.py", line 211, in runsource
    self.runcode(code)
  File "/usr/lib64/python3.13/code.py", line 92, in runcode
    exec(code, self.locals)
  File "<python-input-0>", line 1, in <module>
    import torchvision
  File "/usr/lib64/python3.13/site-packages/torchvision/__init__.py", line 5, in <module>
    import torch
  File "/usr/lib64/python3.13/site-packages/torch/__init__.py", line 2476, in <module>
    from torch import (
  File "/usr/lib64/python3.13/site-packages/torch/export/__init__.py", line 64, in <module>
    from .dynamic_shapes import Constraint, Dim, dims, ShapesCollection
  File "/usr/lib64/python3.13/site-packages/torch/export/dynamic_shapes.py", line 23, in <module>
    from .exported_program import ExportedProgram
  File "/usr/lib64/python3.13/site-packages/torch/export/exported_program.py", line 26, in <module>
    from torch._higher_order_ops.utils import autograd_not_implemented
  File "/usr/lib64/python3.13/site-packages/torch/_higher_order_ops/__init__.py", line 1, in <module>
    from torch._higher_order_ops.cond import cond
  File "/usr/lib64/python3.13/site-packages/torch/_higher_order_ops/cond.py", line 6, in <module>
    import torch._subclasses.functional_tensor
  File "/usr/lib64/python3.13/site-packages/torch/_subclasses/functional_tensor.py", line 46, in <module>
    class FunctionalTensor(torch.Tensor):
  File "/usr/lib64/python3.13/site-packages/torch/_subclasses/functional_tensor.py", line 295, in FunctionalTensor
    cpu = _conversion_method_template(device=torch.device("cpu"))
/usr/lib64/python3.13/site-packages/torch/_subclasses/functional_tensor.py:295: UserWarning: Failed to initialize NumPy: 
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.2.1 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

 (Triggered internally at /builddir/build/BUILD/python-torch-2.5.0-build/pytorch-v2.5.0/torch/csrc/utils/tensor_numpy.cpp:84.)
  cpu = _conversion_method_template(device=torch.device("cpu"))
[W1224 11:01:44.213187434 OperatorEntry.cpp:155] Warning: Warning only once for all operators,  other operators may also be overridden.
  Overriding a previously registered kernel for the same operator and the same dispatch key
  operator: torchvision::roi_align(Tensor input, Tensor rois, float spatial_scale, SymInt pooled_height, SymInt pooled_width, int sampling_ratio, bool aligned) -> Tensor
    registered at /builddir/build/BUILD/python-torchvision-0.20.1-build/vision-0.20.1/torchvision/csrc/ops/roi_align.cpp:124
  dispatch key: CPU
  previous kernel: registered at /builddir/build/BUILD/python-torchvision-0.20.1-build/vision-0.20.1/torchvision/csrc/ops/quantized/cpu/qroi_align_kernel.cpp:283
       new kernel: registered at /builddir/build/BUILD/python-torchvision-0.20.1-build/vision-0.20.1/torchvision/csrc/ops/cpu/roi_align_kernel.cpp:390 (function operator())

A simple bump and rebuild should fix that.

Reproducible: Always

Comment 1 Fedora Update System 2024-12-24 20:36:19 UTC
FEDORA-2024-3d9354c83a (python-torchvision-0.20.1-2.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-3d9354c83a

Comment 2 Fedora Update System 2024-12-24 20:40:50 UTC
FEDORA-2024-3d9354c83a (python-torchvision-0.20.1-2.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.