Trouble with runing an app which uses PythonCall
Hello! I've an error when i'm trying to run an created app which uses PythonCall.
Code for MWE is published here: https://github.com/YuliyaCl/PythonCall_tst.jl.
To create an app run file deploy/compile_app.sh .
Tests and building proccess run correctly but when I'm runing PythonCall_tst.exe in cmd, an error occurs:
fatal: error thrown and no exception handler available.
InitError(mod=:C, error=ErrorException("no environment in the LOAD_PATH depends on CondaPkg"))
error at .\error.jl:33
_resolve_top_env at C:\Users\yzh\.julia\packages\CondaPkg\Olo5Y\src\resolve.jl:16
#resolve#37 at C:\Users\yzh\.julia\packages\CondaPkg\Olo5Y\src\resolve.jl:307
resolve at C:\Users\yzh\.julia\packages\CondaPkg\Olo5Y\src\resolve.jl:288
envdir at C:\Users\yzh\.julia\packages\CondaPkg\Olo5Y\src\env.jl:70
init_context at C:\Users\yzh\.julia\packages\PythonCall\XgP8G\src\cpython\context.jl:56
__init__ at C:\Users\yzh\.julia\packages\PythonCall\XgP8G\src\cpython\CPython.jl:21
jfptr___init___36506.clone_1 at C:\Users\yzh\.julia\dev\PythonCall_tst\PythonCallCompiled\lib\julia\sys.dll (unknown line)
jl_apply at /cygdrive/c/buildbot/worker/package_win64/build/src\julia.h:1788 [inlined]
jl_module_run_initializer at /cygdrive/c/buildbot/worker/package_win64/build/src\toplevel.c:73
_finish_julia_init at /cygdrive/c/buildbot/worker/package_win64/build/src\init.c:796
jl_init_with_image at /cygdrive/c/buildbot/worker/package_win64/build/src\jlapi.c:74 [inlined]
jl_init_with_image at /cygdrive/c/buildbot/worker/package_win64/build/src\jlapi.c:63 [inlined]
jl_init at /cygdrive/c/buildbot/worker/package_win64/build/src\jlapi.c:90
.text at C:\Users\yzh\.julia\dev\PythonCall_tst\PythonCallCompiled\bin\PythonCall_tst.exe (unknown line)
__tmainCRTStartup at C:\Users\yzh\.julia\dev\PythonCall_tst\PythonCallCompiled\bin\PythonCall_tst.exe (unknown line)
.l_start at C:\Users\yzh\.julia\dev\PythonCall_tst\PythonCallCompiled\bin\PythonCall_tst.exe (unknown line)
BaseThreadInitThunk at C:\windows\System32\KERNEL32.DLL (unknown line)
RtlUserThreadStart at C:\windows\SYSTEM32\ntdll.dll (unknown line)
OS: Windows 10 Do you have any ideas how to solve it? Thanks!
Yuliya
Addition information about the issue.
To reproduce the error itself you may compile an app and run the function:
using CondaPkg
PythonCallCompiled\\share\\julia\\Project.toml._resolve_top_env( [ pathToTheProjectToml ] )
pathToTheProjectToml - it's a path to Project.toml file inside folder with compiled app - "....\share\julia\Project.toml"
Also the difference in output occurs when run Base.manifest_uuid_path() with two Project files (to reproduce the error change the paths to yours)
pkg = Base.PkgId(Base.UUID("992eb4ea-22a4-4c89-a5bb-47a3300528ab"), "CondaPkg")
env_raw = "C:\\Users\\yzh\\.julia\\dev\\PythonCall_tst\\Project.toml" #inside the repo
env_compiled = "C:\\Users\\yzh\\.julia\\dev\\PythonCall_tst\\PythonCallCompiled\\share\\julia\\Project.toml" #inside the compiled app folder
out1 = Base.manifest_uuid_path(env_raw, pkg) # -> "C:\\Users\\yzh\\.julia\\dev\\CondaPkg"
out2 = Base.manifest_uuid_path(env_compiled, pkg) # -> nothing
Place in CondaPkg.jl where this trouble occurs: https://github.com/cjdoris/CondaPkg.jl/blob/78f2a639b5bfb88920c7021c568e39d87c112950/src/resolve.jl#L9
UPD:
I thought it couldn't find Manifest-file in Project.toml.
If copy-paste Manifest.toml (where in [[deps.CondaPkg]] parametr path is equal to local path to dev/CondaPkg.jl) to the "...PythonCallCompiled\share\julia" the error ErrorException("no environment in the LOAD_PATH depends on CondaPkg") disappears and another one occurs:
InitError(mod=:C, error=Base.IOError(msg="readdir("C:\\Users\\yzh\\.julia\\dev\\PythonCall_tst\\PythonCallCompiled\\share\\julia\\stdlib\\v1.7"): no such file or directory (ENOENT)", code=-4058))
If copy-paste Manifest-file where [[deps.CondaPkg]] instead of path has git-tree-sha1 the error in issue still exist.
I've also taken a bit of a look.
You can work around the "no environment in the LOAD_PATH depends on CondaPkg" error by changing _resolve_top_env(load_path) so that the if is_condapkg || depends_on_condapkg is just if true (to always use the top environment). It was failing because it couldn't find a Manifest.toml containing CondaPkg.
But this surfaces another error
InitError(mod=:C, error=Pkg.Types.PkgError(msg="expected package `CondaPkg [992eb4ea]` to exist in the manifest (use `resolve` to populate the manifest)"))
Again, this is because there is no Manifest.toml.
Maybe this is a bug in PackageCompiler, erroneously not outputting a Manifest.toml? If you make a trivial app with no dependencies, does it create a Manifest.toml?
Thanks for the answer! I've compiled an app without any dependencies. Manifest.toml wasn't created
Also i've also created an app with only Statistics.jl in deps to check PackageCompiler. Manifest.toml wasn't created but everithing worked correctly.
The problem is in CondaPkg. I've compile an app with only CondaPkg in the deps. It failed at line CondaPkg.status()...
So redirect this issue to CondaPkg.jl ..
This issue has been marked as stale because it has been open for 30 days with no activity. If the issue is still relevant then please leave a comment, or else it will be closed in 7 days.
This issue has been closed because it has been stale for 7 days. If it is still relevant, please re-open it.