Open albertomercurio opened 5 months ago
That error happens here in sympy: https://github.com/sympy/sympy/blob/af0c8559a845df49a6d0f8855659cebd0ddc9bc8/sympy/utilities/lambdify.py#L849
What's happening is that lambdify is assuming it is being called from Python, whereas it's actually being called from Julia (and therefore there are no higher stack frames, which is what that line is trying to access). I'm not familiar with sympy but it looks like it's trying to access the variables in the scope where lambdify is being called from. Which is pretty magical and sketchy TBH.
AFAIK this isn't fixable from PythonCall. You've got a couple of options:
callers_local_vars
only gets computed if it is actually needed. In your case it is not needed. This would just be a mild reordering of the logic of that block. Or add a flag to skip that bit of logic - which looks optional anyway.For option 2 I mean you can do something like
@pyexec """
def lambdify(*args):
import sympy
return sympy.lambdify(*args)
""" => lambdify
then use this lambdify
function instead.
Affects: PythonCall
Describe the bug Minimal working example:
Your system
Additional context Add any other context about the problem here.