Julia Error: InitError when trying to use Plots in Python via JuliaCall

Hello,

I am trying to use the Julia package Plots.jl in Python3.11 via the JuliaCall package on Ubuntu 22.04.4 LTS. (Actually, I try to use another package that is developing a local community but I’m suspecting Plots.jl causes this problem.)
However, I am encountering an InitError when I try to use the Plots package. Here is the error message I am getting:

juliacall.JuliaError: InitError: could not load library "/home/user/.julia/artifacts/648a32a349aac06f19b6bfed47f0b822b4ef28c3/lib/libgio-2.0.so"
/home/user/.julia/artifacts/648a32a349aac06f19b6bfed47f0b822b4ef28c3/lib/libgobject-2.0.so.0: undefined symbol: g_dir_unref

This error occurs when I try to execute the following line in Python:

jl.seval("using Plots")

I am using the JuliaCall package to create a Julia environment in Python, and I am trying to use the Plots package within this environment. I have successfully added the Plots package to my Julia environment using the Pkg module in Julia.

I tried to reinstall Julia and re-run precompile after deleting ‘.julia’.
Also, I tried to change the ENV["LD_LIBRARY_PATH"]="" on python scripts:

jl.seval("ENV[\"LD_LIBRARY_PATH\"]=\"\"")
jl.seval("print(ENV[\"LD_LIBRARY_PATH\"])")

jl.seval("using Plots")

But it did not change this variable to "" so, it did resolve the problem.

I am not sure why this error is occurring, and I would appreciate any help or guidance on how to resolve this issue.

Thank you in advance for your help.

Information of versions

Ubuntu 22.04.4 LTS
Python 3.11.8 (on venv)
Julia version 1.10.2
JulliaCall 0.9.19
Juliapkg 0.1.11

Fumi

1 Like

I am experiencing the same issue.

Could one of you post some complete code to reproduce the issue? That is, show how to set up a new venv and then what to call in python that leads to the error.