You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wrapping a julia package to a python Jupyter notebook with juliacall. But the data obtained from julia can't be properly visualized in Python, as it takes really long. A minimal example below takes 19s to render if ran in console ipython (and even longer in VSCode, for whatever reason):
fromjuliacallimportMainasjljl.rand(10000, 1000)
Same goes for large DataFrames.
Julia version 1.8.5, juliacall version 0.9.7 , python v3.8.0.
Update
From what I understand, the problem comes from pyjlany_repr, which calls repr, which interpolates the whole array into a single string:
So, we get linear dependency on array size. On the other hand, calling juliacall.PythonCall.display(jl.rand(10000, 1000)) works perfectly fine and with reasonable speed.
Is there any way to override the behavior? Honestly, I'd be even fine if we can disable input from Julia objects altogether and require them to be converted to Python first. But the current situation is extremely unfriendly to potential users of my package, as any accidental output of a julia object causes the REPL to hang without any possibility to even interrupt it...
The text was updated successfully, but these errors were encountered:
Right now there's no override, but I'm open to changing the implementation of __repr__ to return a truncated representation instead.
Note that list(range(1000000)) will also print a ton of junk, so this isn't unprecedented behaviour, but I agree that the truncated output that numpy returns is nicer. Plus you can always call jl.repr(x) if you really want the untruncated string.
Uh oh!
There was an error while loading. Please reload this page.
I'm wrapping a julia package to a python Jupyter notebook with juliacall. But the data obtained from julia can't be properly visualized in Python, as it takes really long. A minimal example below takes 19s to render if ran in console ipython (and even longer in VSCode, for whatever reason):
Same goes for large DataFrames.
Julia version 1.8.5, juliacall version 0.9.7 , python v3.8.0.
Update
From what I understand, the problem comes from
pyjlany_repr
, which callsrepr
, which interpolates the whole array into a single string:So, we get linear dependency on array size. On the other hand, calling
juliacall.PythonCall.display(jl.rand(10000, 1000))
works perfectly fine and with reasonable speed.Is there any way to override the behavior? Honestly, I'd be even fine if we can disable input from Julia objects altogether and require them to be converted to Python first. But the current situation is extremely unfriendly to potential users of my package, as any accidental output of a julia object causes the REPL to hang without any possibility to even interrupt it...
The text was updated successfully, but these errors were encountered: