JuliaPy / PyCall.jl

Package to call Python functions from the Julia language
MIT License
1.45k stars 186 forks source link

InitError: importing cv2 and VideoIO #1034

Open ymtoo opened 1 year ago

ymtoo commented 1 year ago

MWE:

julia> using PyCall

julia> py"""
       import cv2
       """

julia> import VideoIO
ERROR: InitError: could not load library "/home/arl/.julia/artifacts/1cfe0ebb804cb8b0d7d1e8f98e5cda94b2b31b3d/lib/libgio-2.0.so"
/home/arl/.julia/artifacts/1cfe0ebb804cb8b0d7d1e8f98e5cda94b2b31b3d/lib/libgobject-2.0.so.0: undefined symbol: g_uri_ref
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl ./libdl.jl:117
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl ./libdl.jl:116
  [3] macro expansion
    @ ~/.julia/packages/JLLWrappers/QpMQW/src/products/library_generators.jl:54 [inlined]
  [4] __init__()
    @ Glib_jll ~/.julia/packages/Glib_jll/EIruA/src/wrappers/x86_64-linux-gnu.jl:18
  [5] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1074
  [6] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
    @ Base ./loading.jl:1020
  [7] _tryrequire_from_serialized(modkey::Base.PkgId, path::String, ocachepath::String, sourcepath::String, depmods::Vector{Any})
    @ Base ./loading.jl:1354
  [8] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
    @ Base ./loading.jl:1457
  [9] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1750
 [10] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1623
 [11] macro expansion
    @ ./loading.jl:1611 [inlined]
 [12] macro expansion
    @ ./lock.jl:267 [inlined]
 [13] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1574
during initialization of module Glib_jll

Julia and the package versions:

julia> versioninfo()
Julia Version 1.9.0-rc2
Commit 72aec423c2a (2023-04-01 10:41 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 24 × AMD Ryzen 9 5900X 12-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, znver3)
  Threads: 1 on 24 virtual cores
Environment:
  LD_LIBRARY_PATH = /usr/local/cuda-11.7/lib64:

(jl_ayVwEU) pkg> st
Status `/tmp/jl_ayVwEU/Project.toml`
  [438e738f] PyCall v1.95.1
  [d6d074c3] VideoIO v1.0.5

shell> pip show opencv-python
Name: opencv-python
Version: 4.5.1.48
Summary: Wrapper package for OpenCV python bindings.
Home-page: https://github.com/skvark/opencv-python
ymtoo commented 1 year ago

This works.

julia> import VideoIO

julia> using PyCall

julia> py"""
       import cv2
       """