Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows unittest jobs fail due to numpy 2 dependency issue #8531

Closed
NicolasHug opened this issue Jul 17, 2024 · 2 comments
Closed

Windows unittest jobs fail due to numpy 2 dependency issue #8531

NicolasHug opened this issue Jul 17, 2024 · 2 comments

Comments

@NicolasHug
Copy link
Member

All other jobs are fine but the windows unittests job are failing.

I'll pin the dep to numpy<2 in #8530 to keep the CI green but we should resolve this asap

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 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 "C:\actions-runner\_work\vision\vision\pytorch\vision\test\smoke_test.py", line 6, in <module>
    import torch
  File "C:\Jenkins\Miniconda3\envs\ci\lib\site-packages\torch\__init__.py", line 2455, in <module>
    from torch import (
  File "C:\Jenkins\Miniconda3\envs\ci\lib\site-packages\torch\export\__init__.py", line 64, in <module>
    from .dynamic_shapes import Constraint, Dim, dims, dynamic_dim, ShapesCollection
  File "C:\Jenkins\Miniconda3\envs\ci\lib\site-packages\torch\export\dynamic_shapes.py", line 18, in <module>
    from .exported_program import ExportedProgram
  File "C:\Jenkins\Miniconda3\envs\ci\lib\site-packages\torch\export\exported_program.py", line 25, in <module>
    from torch._higher_order_ops.utils import autograd_not_implemented
  File "C:\Jenkins\Miniconda3\envs\ci\lib\site-packages\torch\_higher_order_ops\__init__.py", line 1, in <module>
    from torch._higher_order_ops.cond import cond
  File "C:\Jenkins\Miniconda3\envs\ci\lib\site-packages\torch\_higher_order_ops\cond.py", line 7, in <module>
    import torch._subclasses.functional_tensor
  File "C:\Jenkins\Miniconda3\envs\ci\lib\site-packages\torch\_subclasses\functional_tensor.py", line 42, in <module>
    class FunctionalTensor(torch.Tensor):
  File "C:\Jenkins\Miniconda3\envs\ci\lib\site-packages\torch\_subclasses\functional_tensor.py", line 267, in FunctionalTensor
    cpu = _conversion_method_template(device=torch.device("cpu"))
C:\Jenkins\Miniconda3\envs\ci\lib\site-packages\torch\_subclasses\functional_tensor.py:267: UserWarning: Failed to initialize NumPy: 
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 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 C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\torch\csrc\utils\tensor_numpy.cpp:84.)
  cpu = _conversion_method_template(device=torch.device("cpu"))
Downloading: "https://download.pytorch.org/models/resnet50-11ad3fa6.pth" to C:\Users\runneruser/.cache\torch\hub\checkpoints\resnet50-11ad3fa6.pth
torchvision: 0.20.0a0+a36b98b
torch.cuda.is_available: False
torch.ops.image._jpeg_version() = 80
Is torchvision usable? True
German shepherd (cpu): 37.6%
============================= test session starts =============================
platform win32 -- Python 3.9.19, pytest-7.4.4, pluggy-1.5.0 -- C:\Jenkins\Miniconda3\envs\ci\python.exe
cachedir: .pytest_cache
rootdir: C:\actions-runner\_work\vision\vision\pytorch\vision
configfile: pytest.ini
testpaths: test
plugins: cov-5.0.0, mock-3.14.0
collecting ... collected 37400 items / 2 errors / 1 skipped

=================================== ERRORS ====================================
__________________ ERROR collecting test/test_transforms.py ___________________
test\test_transforms.py:606: in <module>
    class TestToPil:
test\test_transforms.py:664: in TestToPil
    (torch.Tensor(4, 4, 1).uniform_().numpy(), "L"),
E   RuntimeError: Numpy is not available
______________ ERROR collecting test/test_transforms_v2_utils.py ______________
test\test_transforms_v2_utils.py:47: in <module>
    (to_pil_image(IMAGE),),
torchvision\transforms\functional.py:266: in to_pil_image
    pic = pic.numpy(force=True)
E   RuntimeError: Numpy is not available
============================== warnings summary ===============================
..\..\..\..\..\..\Jenkins\Miniconda3\envs\ci\lib\site-packages\torch\_subclasses\functional_tensor.py:267
  C:\Jenkins\Miniconda3\envs\ci\lib\site-packages\torch\_subclasses\functional_tensor.py:267: UserWarning: Failed to initialize NumPy: 
  A module that was compiled using NumPy 1.x cannot be run in
  NumPy 2.0.0 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 C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\torch\csrc\utils\tensor_numpy.cpp:84.)
    cpu = _conversion_method_template(device=torch.device("cpu"))

test\test_backbone_utils.py:51
  C:\actions-runner\_work\vision\vision\pytorch\vision\test\test_backbone_utils.py:51: PytestCollectionWarning: cannot collect test class 'TestSubModule' because it has a __init__ constructor (from: test/test_backbone_utils.py)
    class TestSubModule(torch.nn.Module):

test\test_backbone_utils.py:64
  C:\actions-runner\_work\vision\vision\pytorch\vision\test\test_backbone_utils.py:64: PytestCollectionWarning: cannot collect test class 'TestModule' because it has a __init__ constructor (from: test/test_backbone_utils.py)
    class TestModule(torch.nn.Module):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
- generated xml file: C:\actions-runner\_work\_temp\test-results\test-results.xml -
=========================== short test summary info ===========================
ERROR test/test_transforms.py - RuntimeError: Numpy is not available
ERROR test/test_transforms_v2_utils.py - RuntimeError: Numpy is not available
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!
================== 1 skipped, 3 warnings, 2 errors in 6.45s ===================
@adamjstewart
Copy link
Contributor

Seems to be fixed since #8594 was merged?

@NicolasHug
Copy link
Member Author

Oh, yes, I forgot to link it. Thanks @adamjstewart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants