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

Error in docker #529

Open
joerowelll opened this issue Oct 1, 2024 · 1 comment
Open

Error in docker #529

joerowelll opened this issue Oct 1, 2024 · 1 comment

Comments

@joerowelll
Copy link

joerowelll commented Oct 1, 2024

When trying to run the grounded_sam_demo.py in the provided docker, I get this error stating:

$ python Grounded-Segment-Anything/grounded_sam_demo.py 

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.1.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 "/home/appuser/Grounded-Segment-Anything/grounded_sam_demo.py", line 15, in <module>
    import GroundingDINO.groundingdino.datasets.transforms as T
  File "/home/appuser/Grounded-Segment-Anything/GroundingDINO/groundingdino/datasets/transforms.py", line 10, in <module>
    import torchvision.transforms as T
  File "/opt/conda/lib/python3.10/site-packages/torchvision/__init__.py", line 5, in <module>
    from torchvision import datasets, io, models, ops, transforms, utils
  File "/opt/conda/lib/python3.10/site-packages/torchvision/models/__init__.py", line 17, in <module>
    from . import detection, optical_flow, quantization, segmentation, video
  File "/opt/conda/lib/python3.10/site-packages/torchvision/models/detection/__init__.py", line 1, in <module>
    from .faster_rcnn import *
  File "/opt/conda/lib/python3.10/site-packages/torchvision/models/detection/faster_rcnn.py", line 16, in <module>
    from .anchor_utils import AnchorGenerator
  File "/opt/conda/lib/python3.10/site-packages/torchvision/models/detection/anchor_utils.py", line 10, in <module>
    class AnchorGenerator(nn.Module):
  File "/opt/conda/lib/python3.10/site-packages/torchvision/models/detection/anchor_utils.py", line 63, in AnchorGenerator
    device: torch.device = torch.device("cpu"),
/opt/conda/lib/python3.10/site-packages/torchvision/models/detection/anchor_utils.py:63: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at /opt/conda/conda-bld/pytorch_1670525552843/work/torch/csrc/utils/tensor_numpy.cpp:77.)
  device: torch.device = torch.device("cpu"),

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.1.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 "/home/appuser/Grounded-Segment-Anything/grounded_sam_demo.py", line 16, in <module>
    from GroundingDINO.groundingdino.models import build_model
  File "/home/appuser/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/__init__.py", line 8, in <module>
    from .GroundingDINO import build_groundingdino
  File "/home/appuser/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/__init__.py", line 15, in <module>
    from .groundingdino import build_groundingdino
  File "/home/appuser/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/groundingdino.py", line 37, in <module>
    from groundingdino.util.visualizer import COCOVisualizer
  File "/home/appuser/Grounded-Segment-Anything/GroundingDINO/groundingdino/util/visualizer.py", line 12, in <module>
    import cv2
  File "/opt/conda/lib/python3.10/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/opt/conda/lib/python3.10/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/opt/conda/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
AttributeError: _ARRAY_API not found
Traceback (most recent call last):
  File "/home/appuser/Grounded-Segment-Anything/grounded_sam_demo.py", line 16, in <module>
    from GroundingDINO.groundingdino.models import build_model
  File "/home/appuser/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/__init__.py", line 8, in <module>
    from .GroundingDINO import build_groundingdino
  File "/home/appuser/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/__init__.py", line 15, in <module>
    from .groundingdino import build_groundingdino
  File "/home/appuser/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/groundingdino.py", line 37, in <module>
    from groundingdino.util.visualizer import COCOVisualizer
  File "/home/appuser/Grounded-Segment-Anything/GroundingDINO/groundingdino/util/visualizer.py", line 12, in <module>
    import cv2
  File "/opt/conda/lib/python3.10/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/opt/conda/lib/python3.10/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/opt/conda/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: numpy.core.multiarray failed to import
@fatzh
Copy link

fatzh commented Oct 1, 2024

try pip install "numpy<2" in your docker container, to see if that works ?

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