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

RuntimeError: Numpy is not available #7

Open
gyillikci opened this issue Sep 20, 2023 · 2 comments
Open

RuntimeError: Numpy is not available #7

gyillikci opened this issue Sep 20, 2023 · 2 comments

Comments

@gyillikci
Copy link

Hi, Thanks for the work. looks very promising

I am having some problem with basic example and actually with others as well. I get runtime error on Numpy as below

python3 examples/basic_usage.py \

--image_encoder="data/resnet18_image_encoder.engine" \
--mask_decoder="data/mobile_sam_mask_decoder.engine"

/home/dbox1028/.local/lib/python3.8/site-packages/torchvision/models/detection/anchor_utils.py:63: UserWarning: Failed to initialize NumPy: module compiled against API version 0x10 but this version of numpy is 0xd . Check the section C-API incompatibility at the Troubleshooting ImportError section at https://numpy.org/devdocs/user/troubleshooting-importerror.html#c-api-incompatibility for indications on how to solve this problem . (Triggered internally at /root/pytorch/torch/csrc/utils/tensor_numpy.cpp:84.)
device: torch.device = torch.device("cpu"),
Traceback (most recent call last):
File "examples/basic_usage.py", line 38, in
predictor.set_image(image)
File "/home/dbox1028/nanosam/nanosam/utils/predictor.py", line 154, in set_image
self.image_tensor = preprocess_image(image, self.image_encoder_size)
File "/home/dbox1028/nanosam/nanosam/utils/predictor.py", line 84, in preprocess_image
image_torch_resized = torch.from_numpy(image_np_resized).permute(2, 0, 1)
RuntimeError: Numpy is not available

@jaybdub
Copy link
Contributor

jaybdub commented Sep 20, 2023

Hi @gyillikci ,

Thanks for reaching out.

While I haven't faced this issue, it's like an issue with the numpy version installed.

Could you try installing a different version of numpy? This post suggests pip install numpy==1.24.1.

Let me know if this works for you or you still face this issue.

Best,
John

@gyillikci
Copy link
Author

Thanks Jay,
That works well.

Best,
Giray

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