avik-pal / Wandb.jl

Unofficial Julia bindings for logging experiments to wandb.ai
https://avik-pal.github.io/Wandb.jl/stable/
MIT License
82 stars 11 forks source link

Incompatible with plotting packages #36

Closed trahflow closed 3 months ago

trahflow commented 5 months ago

On my (arch linux) system, python throws the following error if I

ERROR: Python: ImportError: /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/lib-dynload/pyexpat.cpython-312-x86_64-linux-gnu.so: undefined symbol: XML_SetReparseDeferralEnabled

Stacktrace

``` Python stacktrace: [1] @ /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/xml/parsers/expat.py:4 [2] @ /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/plistlib.py:70 [3] @ /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/site-packages/pkg_resources/__init__.py:40 [4] parse_version @ wandb.util /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/site-packages/wandb/util.py:1891 [5] _server_accepts_client_ids @ wandb.sdk.data_types.base_types.wb_value /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/site-packages/wandb/sdk/data_types/base_types/wb_value.py:33 [6] _get_artifact_entry_ref_url @ wandb.sdk.data_types.base_types.wb_value /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/site-packages/wandb/sdk/data_types/base_types/wb_value.py:220 [7] to_json @ wandb.sdk.data_types.base_types.media /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/site-packages/wandb/sdk/data_types/base_types/media.py:172 [8] to_json @ wandb.data_types /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/site-packages/wandb/data_types.py:554 [9] val_to_json @ wandb.sdk.data_types.utils /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/site-packages/wandb/sdk/data_types/utils.py:166 [10] history_dict_to_json @ wandb.sdk.data_types.utils /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/site-packages/wandb/sdk/data_types/utils.py:52 [11] publish_partial_history @ wandb.sdk.interface.interface /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/site-packages/wandb/sdk/interface/interface.py:572 [12] _partial_history_callback @ wandb.sdk.wandb_run /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/site-packages/wandb/sdk/wandb_run.py:1474 [13] _log @ wandb.sdk.wandb_run /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/site-packages/wandb/sdk/wandb_run.py:1602 [14] log @ wandb.sdk.wandb_run /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/site-packages/wandb/sdk/wandb_run.py:1838 [15] wrapper @ wandb.sdk.wandb_run /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/site-packages/wandb/sdk/wandb_run.py:361 [16] wrapper_fn @ wandb.sdk.wandb_run /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/site-packages/wandb/sdk/wandb_run.py:371 [17] wrapper @ wandb.sdk.wandb_run /tmp/jl_7X2lxa/.CondaPkg/env/lib/python3.12/site-packages/wandb/sdk/wandb_run.py:420 Stacktrace: [1] pythrow() @ PythonCall.Core ~/.julia/packages/PythonCall/bb3ax/src/Core/err.jl:92 [2] errcheck @ ~/.julia/packages/PythonCall/bb3ax/src/Core/err.jl:10 [inlined] [3] pycallargs @ ~/.julia/packages/PythonCall/bb3ax/src/Core/builtins.jl:212 [inlined] [4] pycall(f::PythonCall.Core.Py, args::PythonCall.Core.Py; kwargs::@Kwargs{}) @ PythonCall.Core ~/.julia/packages/PythonCall/bb3ax/src/Core/builtins.jl:230 [5] pycall @ ~/.julia/packages/PythonCall/bb3ax/src/Core/builtins.jl:220 [inlined] [6] Py @ ~/.julia/packages/PythonCall/bb3ax/src/Core/Py.jl:339 [inlined] [7] log(lg::WandbLogger, logs::Dict{String, PythonCall.Core.Py}; kwargs::@Kwargs{}) @ Wandb ~/.julia/packages/Wandb/jByAm/src/main.jl:69 [8] top-level scope @ REPL[10]:1 ```

Note that everything works fine if I don't import any plotting packages.

Minimal example to reproduce the error:

using Wandb, Plots

lg = WandbLogger(project="dummyproject")

x = collect(1.0:20.0)
y = cumsum(rand(20))
s = ones(20)

table = Wandb.Table(data=[x;;y;;s], columns=["Frequency", "FSC", "stroke"])
plt = Wandb.plot_line(table, "Frequency", "FSC", "stroke", "Fourier Shell Correlation")
Wandb.log(lg, Dict("FSC plot" => plt))

close(lg)
versioninfo

julia> versioninfo() Julia Version 1.10.2 Commit bd47eca2c8a (2024-03-01 10:14 UTC) Build Info: Official https://julialang.org/ release Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 8 × 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-15.0.7 (ORCJIT, tigerlake) Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores) Environment: JULIA_CONDAPKG_BACKEND = System

avik-pal commented 3 months ago

What happens if you use the default CondaPkg settings (without using system python)? Atleast with CairoMakie, I don't seem to get any issues.

Also maybe use python 3.11 instead of 3.12, quite a few packages have compatibility issues with 3.12 afaik.

trahflow commented 3 months ago

What happens if you use the default CondaPkg settings (without using system python)? Atleast with CairoMakie, I don't seem to get any issues.

Ok I've tried different combinations of CondaPkg backends (System as well as MicroMamba) and Plots and CairoMakie and all seem to work now. Not sure what has fixed this or why the problem appeared in the first place, but it works now :)