-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not load python library when run from compiled julia app on another machine #981
Comments
Yes, compiling in the |
There are some other problems compiling app with PythonCall - see here: JuliaPy/PythonCall.jl#146 @stevengj Can you please explain a little bit more, what should be fixed in PyCall to exclude fixed library paths from compiled binaries? Or any other ways to use it with compiled app? |
I also encountered this problem today, almost the exact same error message as @sairus7 . At first I used |
I wonder if it's as simple as inserting the following line here: libpython = relpath.(libpython, @__DIR__) Want to give it a try? |
Oh, things seem to crash in the same way with fixed absolute path... Any other operations needed before building the app? And I wonder if this is the right absolute path for
|
Make sure you |
Thanks, but this error was thrown when building the pkgs in my project environment
|
To compile the project into an app I use project own environment, not the default one.
|
Maybe that's because |
Sorry, is this solution works for you? And that may be my problem... |
I will check this in a couple of hours |
Great, but problem is that the path actually should not be |
I confirmed that the error was caused by that line of code. after commenting that line:
cancel commenting that line:
|
I got the correct build result after replace libpython = relpath.(libpy_name, @__DIR__) The value of |
This fix didn't work for me - it runs through tests and compilation stages, but trying to run the app gives the same error as in the first message. |
Hi, I was wrong in the last comment. I stuck here when replaced both julia> import Pkg; Pkg.precompile()
Precompiling project...
✗ PyCall
0 dependencies successfully precompiled in 2 seconds (239 already precompiled)
ERROR: The following 1 direct dependency failed to precompile:
PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45ab0]
Failed to precompile PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45ab0] to C:\Users\JerryYang\.julia\compiled\v1.7\PyCall\jl_DD83.tmp.
ERROR: LoadError: could not load library "..\..\..\..\conda\3\python39.dll"
The specified module could not be found. . Please run `Pkg.build("PyCall")` if your Python build has changed
Stacktrace:
[1] error(::String, ::String)
@ Base .\error.jl:42
[2] top-level scope
@ C:\Users\JerryYang\.julia\packages\PyCall\7a7w0\src\startup.jl:51
[3] include(mod::Module, _path::String)
@ Base .\Base.jl:418
[4] include(x::String)
@ PyCall C:\Users\JerryYang\.julia\packages\PyCall\7a7w0\src\PyCall.jl:1
[5] top-level scope
@ C:\Users\JerryYang\.julia\packages\PyCall\7a7w0\src\PyCall.jl:38
[6] include
@ .\Base.jl:418 [inlined]
[7] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
@ Base .\loading.jl:1318
[8] top-level scope
@ none:1
[9] eval
@ .\boot.jl:373 [inlined]
[10] eval(x::Expr)
@ Base.MainInclude .\client.jl:453
[11] top-level scope
@ none:1
in expression starting at C:\Users\JerryYang\.julia\packages\PyCall\7a7w0\src\startup.jl:41
in expression starting at C:\Users\JerryYang\.julia\packages\PyCall\7a7w0\src\PyCall.jl:1 I look into it, and it is this line Line 48 in 6b18f38
|
It actually did not run through tests, with a skipped error message like this:
|
I think just replace the absolute |
Such modification only changed the variable const python = "C:\\Users\\JerryYang\\.julia\\conda\\3\\python.exe"
const libpython = "..\\..\\..\\..\\conda\\3\\python39.dll"
const pyprogramname = "C:\\Users\\JerryYang\\.julia\\conda\\3\\python.exe"
const pyversion_build = v"3.9.10"
const PYTHONHOME = "C:\\Users\\JerryYang\\.julia\\conda\\3"
"True if we are using the Python distribution in the Conda package."
const conda = true |
When I compile my app that has a PyCall dependency, it could not find python library, because it is compiled with absolute path to that library found on dev machine. So when I run my app on another machine, it can't find it:
So its this line
pyinit.jl:149
:PyCall.jl/src/pyinit.jl
Line 150 in 6b18f38
The text was updated successfully, but these errors were encountered: