Skip to content

Mac M1 pro segmentation fault on import #5893

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

Open
axmav opened this issue Apr 27, 2022 · 6 comments
Open

Mac M1 pro segmentation fault on import #5893

axmav opened this issue Apr 27, 2022 · 6 comments

Comments

@axmav
Copy link

axmav commented Apr 27, 2022

🐛 Describe the bug

Hello! Can not import torchvision on my mac. Get an error:
libc++abi: terminating with uncaught exception of type std::length_error: vector
as well as segmentation fault.

code:

import torch
from torch import nn
from torch.nn import functional as F
from torch.distributions.normal import Normal
from torch.distributions.kl import kl_divergence
from torchvision.utils import save_image

it also fails just with from torchvision.utils import save_image

Similar issue: pyg-team/pytorch_geometric#4419
But not a single proposed solution works...

Versions

PyTorch version: 1.10.2
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 12.1 (arm64)
GCC version: Could not collect
Clang version: 13.1.6 (clang-1316.0.21.2.3)
CMake version: Could not collect
Libc version: N/A

Python version: 3.9.10 | packaged by conda-forge | (main, Feb 1 2022, 21:25:34) [Clang 11.1.0 ] (64-bit runtime)
Python platform: macOS-12.1-arm64-arm-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.21.5
[pip3] torch==1.10.2
[pip3] torchaudio==0.11.0
[pip3] torchvision==0.12.0
[conda] numpy 1.21.5 py39h47fb9ce_0 conda-forge
[conda] torch 1.10.2 pypi_0 pypi
[conda] torchaudio 0.11.0 pypi_0 pypi
[conda] torchvision 0.12.0 pypi_0 pypi

@datumbox
Copy link
Contributor

TorchVision doesn't properly provide support for this at the moment. We have a todo to investigate at #5171 but we don't currently have the bandwidth to resolve.

We'll definitely need to fix once when we investigate. Also by briefly checking the linked issue but I'm not sure what exactly it's invoking the libc++abi when you simply import from torchvision.utils import save_image. I wonder if that's linked to the @torch.no_grad() decorator. Could you test this out?

@axmav
Copy link
Author

axmav commented Apr 27, 2022

@datumbox could you provide me with a code? Idk what is decorator.
But I solved this problem by downgrading to pip install "torchvision==0.11.3"

@datumbox
Copy link
Contributor

@axmav I was wonder what would happen if you try to import a dummy method like this:

import torch

@torch.no_grad()
def dummy():
    return 0

@axmav
Copy link
Author

axmav commented Apr 27, 2022

@axmav I was wonder what would happen if you try to import a dummy method like this:

import torch

@torch.no_grad()
def dummy():
    return 0

yes, this works on 0.12.0

@finnatsea
Copy link

I also had this issue on m1. Fixed by using pip install "torchvision==0.11.3"

@liderrick616
Copy link

doesn't work, still get segmentation 11, on Mac M2

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

4 participants