Skip to content

Heap corruption on Python when torch is imported before juliacall, but not the reverse #215

Closed
@MilesCranmer

Description

@MilesCranmer

Here is my system information:

  • Python 3.8.9
  • Julia 1.8.0
  • macOS 12
  • M1 chip (ARM64)
  • Python from homebrew (not conda)

I have not tested this on other systems.

Here is the trigger:

>>> import torch
>>> from juliacall import Main as jl

and the error:

Python(65251,0x104cf8580) malloc: Heap corruption detected, free list is damaged at 0x600001c17280
*** Incorrect guard value: 1903002876
Python(65251,0x104cf8580) malloc: *** set a breakpoint in malloc_error_break to debug
[1]    65251 abort      ipython

However, I can run the following just fine:

>>> from juliacall import Main as jl
>>> import torch

Here are some related issues: JuliaPy/pyjulia#125, pytorch/pytorch#78829. Particularly, check out the comment from @tttc3: pytorch/pytorch#78829 (comment).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions