PackageCompiler.jl icon indicating copy to clipboard operation
PackageCompiler.jl copied to clipboard

Create app with conda dependencies

Open philippwitte opened this issue 1 year ago • 2 comments

I'm trying to create a relocatable app that has Python/Conda dependencies. E.g., in the simplest case, I'm creating an app that has PyPlot as the only dependency:

uuid = "60e04576-4d8c-4856-bc57-482afded9445"
authors = ["user"]
version = "0.1.0"

[deps]
PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee"

The app itself looks like this (i.e. a simplified version of the example from PackageCompiler.jl):

module TestApp

using PyPlot

function julia_main()::Cint
    try
        real_main()
    catch
        Base.invokelatest(Base.display_error, Base.catch_stack())
        return 1
    end
    return 0
end


function real_main()
    @show ARGS
    @show Base.PROGRAM_FILE
    @show DEPOT_PATH
    @show LOAD_PATH
    @show pwd()
    @show Base.active_project()
    @show Sys.BINDIR

    @show Base.JLOptions().opt_level
    @show Base.JLOptions().nthreads
    @show Base.JLOptions().check_bounds

    display(Base.loaded_modules)
    println()

    println("Running a jll package:")

    return
end

end # module

Creating the app with create_app("TestApp", "TestAppCompiled") works as expected and I can run the binary. However, once I zip the compiled app and run it on a different machine, I'm getting a library error:

InitError(mod=:PyCall, error=ErrorException("could not load library "/home/user/.julia/conda/3/lib/libpython3.9.so.1.0"

So, it looks like conda was not included in the app and instead the library file from my local Julia installation is used. Any suggestions on how to address this?

philippwitte avatar Jan 04 '23 23:01 philippwitte