JuliaCall segmentation fault

I’ve got a Julia module (which contains compiled Fortran code) which is called in Python using JuliaCall (The Python module JuliaCall · PythonCall & JuliaCall), for example within a Python script:

from juliacall import Main as jl
jl.seval(using MyModule.jl)

When I then call this in a Python function:

def mypythonfunction():
    Output = jl.MyModule.calc_something(args)

I get an instant segmentation fault (11), any ideas?

Edit: A note, this fails even when not using the compiled Fortran code and calling straight Julia code.

Update, this is also the same using PyJulia. As soon as I import the module in the global scope and try call it within a function it instantly segfaults.

I am at a loss!

Can you post a MWE please.

Sure, my Julia module looks like this:

module myModule

where constants.jl is a simple dictionary:

    "La"=> 162.9085,

I then call it in Python using:

#!/usr/bin/env python3

from juliacall import Main as jl
jl.seval("using myModule")

def test_julia_import():


Interestingly this MWE works no problem. The problem arises when I try to do this inside a Django (I’m not sure if you’re familiar with Django but it’s a Web Dev framework) view. A Django view is similarly a Python function, for example:

def django_view(request):

if I call test_julia() within this, it instantly segfaults:

signal (11): Segmentation fault
in expression starting at none:0
Allocations: 6828442 (Pool: 6825828; Big: 2614); GC: 8

Seems like it’s Django specific?

@cjdoris this is possibly related?