Why is it needed for the examples? Why not have all the examples run in a self-contained environment with all the dependencies they need to work properly?
Also, with your current script I am getting a different error:
mkdir test
cd test
git clone https://github.com/ufechner7/KiteModels.jl.git
cd KiteModels.jl/bin
./create_sys_image --update
Precompiling project...
23 dependencies successfully precompiled in 10 seconds. 324 already precompiled.
[ Info: Loading packages ...
[ Info: Creating sysimage ...
[ Info: PackageCompiler: Executing /home/nathan/Downloads/test/KiteModels.jl/test/test_for_precompile.jl => /tmp/jl_packagecompiler_phS3rT/jl_VauxTl
ERROR: LoadError: InitError: PyError (PyImport_ImportModule
The Python package matplotlib could not be imported by pyimport. Usually this means
that you did not install matplotlib in the Python version being used by PyCall.
PyCall is currently configured to use the Python version at:
/usr/bin/python3
and you should use whatever mechanism you usually use (apt-get, pip, conda,
etcetera) to install the Python package containing the matplotlib module.
One alternative is to re-configure PyCall to use a different Python
version on your system: set ENV["PYTHON"] to the path/name of the python
executable you want to use, run Pkg.build("PyCall"), and re-launch Julia.
Another alternative is to configure PyCall to use a Julia-specific Python
distribution via the Conda.jl package (which installs a private Anaconda
Python distribution), which has the advantage that packages can be installed
and kept up-to-date via Julia. As explained in the PyCall documentation,
set ENV["PYTHON"]="", run Pkg.build("PyCall"), and re-launch Julia. Then,
To install the matplotlib module, you can use `pyimport_conda("matplotlib", PKG)`,
where PKG is the Anaconda package that contains the module matplotlib,
or alternatively you can use the Conda package directly (via
`using Conda` followed by `Conda.add` etcetera).
) <class 'ModuleNotFoundError'>
ModuleNotFoundError("No module named 'matplotlib'")
Stacktrace:
[1] pyimport(name::String)
@ PyCall ~/.julia/packages/PyCall/1gn3u/src/PyCall.jl:558
[2] pyimport_conda(modulename::String, condapkg::String, channel::String)
@ PyCall ~/.julia/packages/PyCall/1gn3u/src/PyCall.jl:716
[3] pyimport_conda
@ ~/.julia/packages/PyCall/1gn3u/src/PyCall.jl:715 [inlined]
[4] __init__()
@ PyPlot ~/.julia/packages/PyPlot/rWSdf/src/init.jl:174
[5] run_module_init(mod::Module, i::Int64)
@ Base ./loading.jl:1134
[6] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
@ Base ./loading.jl:1122
[7] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::Nothing, depmods::Vector{Any})
@ Base ./loading.jl:1067
[8] _tryrequire_from_serialized(modkey::Base.PkgId, path::String, ocachepath::Nothing, sourcepath::String, depmods::Vector{Any})
@ Base ./loading.jl:1481
[9] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
@ Base ./loading.jl:1574
[10] _require(pkg::Base.PkgId, env::String)
@ Base ./loading.jl:1938
[11] __require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base ./loading.jl:1812
[12] #invoke_in_world#3
@ ./essentials.jl:926 [inlined]
[13] invoke_in_world
@ ./essentials.jl:923 [inlined]
[14] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base ./loading.jl:1803
[15] macro expansion
@ ./loading.jl:1790 [inlined]
[16] macro expansion
@ ./lock.jl:267 [inlined]
[17] __require(into::Module, mod::Symbol)
@ Base ./loading.jl:1753
[18] #invoke_in_world#3
@ ./essentials.jl:926 [inlined]
[19] invoke_in_world
@ ./essentials.jl:923 [inlined]
[20] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1746
[21] top-level scope
@ ~/Downloads/test/KiteModels.jl/test/test_for_precompile.jl:12
during initialization of module PyPlot
in expression starting at /home/nathan/Downloads/test/KiteModels.jl/test/test_for_precompile.jl:1
ERROR: LoadError: failed process: Process(setenv(`/home/nathan/.julia/juliaup/julia-1.10.5+0.x64.linux.gnu/bin/julia --color=yes --startup-file=no --pkgimages=no --sysimage=/home/nathan/.julia/juliaup/julia-1.10.5+0.x64.linux.gnu/lib/julia/sys.so --compile=all --trace-compile=/tmp/jl_packagecompiler_phS3rT/jl_VauxTl test/test_for_precompile.jl`,[…]), ProcessExited(1)) [1]
Stacktrace:
[1] pipeline_error
@ ./process.jl:565 [inlined]
[2] run(::Cmd; wait::Bool)
@ Base ./process.jl:480
[3] run
@ ./process.jl:477 [inlined]
[4] run_precompilation_script(project::String, sysimg::String, precompile_file::String, precompile_dir::String)
@ PackageCompiler ~/.julia/packages/PackageCompiler/nT5sD/src/PackageCompiler.jl:306
[5] create_sysimg_object_file(object_file::String, packages::Vector{String}, packages_sysimg::Set{Base.PkgId}; project::String, base_sysimage::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, cpu_target::String, script::Nothing, sysimage_build_args::Cmd, extra_precompiles::String, incremental::Bool)
@ PackageCompiler ~/.julia/packages/PackageCompiler/nT5sD/src/PackageCompiler.jl:344
[6] create_sysimg_object_file
@ ~/.julia/packages/PackageCompiler/nT5sD/src/PackageCompiler.jl:311 [inlined]
[7] create_sysimage(packages::Vector{Symbol}; sysimage_path::String, project::String, precompile_execution_file::String, precompile_statements_file::Vector{String}, incremental::Bool, filter_stdlibs::Bool, cpu_target::String, script::Nothing, sysimage_build_args::Cmd, include_transitive_dependencies::Bool, base_sysimage::Nothing, julia_init_c_file::Nothing, julia_init_h_file::Nothing, version::Nothing, soname::Nothing, compat_level::String, extra_precompiles::String)
@ PackageCompiler ~/.julia/packages/PackageCompiler/nT5sD/src/PackageCompiler.jl:628
[8] top-level scope
@ ~/Downloads/test/KiteModels.jl/test/create_sys_image.jl:14
[9] include(fname::String)
@ Base.MainInclude ./client.jl:489
[10] top-level scope
@ none:1
in expression starting at /home/nathan/Downloads/test/KiteModels.jl/test/create_sys_image.jl:14