x@x pythoncall % python -c 'import torch; from torch.autograd import Function; import juliacall'
zsh: segmentation fault python3 -c
x@x pythoncall % be sad
zsh: command not found: be
After
x@x pythoncall % python -c 'import torch; from torch.autograd import Function; import juliacall'
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/juliacall/__init__.py:62: UserWarning: `torch` was loaded before the juliacall. This may cause a segfault. To avoid this, import `juliacall` *before* importing `torch`. For updates, see https://github.com/pytorch/pytorch/issues/78829
warnings.warn(
zsh: segmentation fault python3 -c
x@x pythoncall % python -c 'import juliacall; import torch; from torch.autograd import Function'
x@x
Before
After
Helps with https://github.com/JuliaPy/PythonCall.jl/issues/384, but doesn't solve the issue satisfactorily.