Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

segmentation fault python after import torch on mac M1

I struggled to install pytorch on my Mac M1 chip.

I fixed the previous issue with mkl here

Now I do:

conda install ipykernel jupyter numpy pandas matplotlib nomkl 
pip install torch torchvision
python
import torch

and I get:

zsh:segmentation fault  python 

from terminal, when I run jupyter - the kernel just crashes

how to fix it?

like image 218
Intelligent-Infrastructure Avatar asked Sep 02 '25 16:09

Intelligent-Infrastructure


1 Answers

its because of a numpy dependency conflict, try this one: first import numpy, and then torch:

import numpy; import torch

like image 87
Reza SA Avatar answered Sep 05 '25 11:09

Reza SA