PackageCompiler.jl: packages(s) {MyCustomModules...} not in project

I’m trying to use PackageCompiler.jl to reduce the startup time for a server that uses some custom modules (CreditScoreEstimation, WalletOptimization, UserProfiles).

approvalPath = joinpath(@__DIR__, "Algorithms-Approval" )
union!(LOAD_PATH, [approvalPath])
println("Loading Credit Score Module")
@time import CreditScoreEstimation

walletOptimPath = joinpath(@__DIR__, "Algorithms-Wallet-Optimization" )
union!(LOAD_PATH, [walletOptimPath])
println("Loading Wallet Optimzation Module")
@time import WalletOptimization

println("Loading User Profile Module")
userProfilePath = joinpath(@__DIR__, "Algorithms-User-Profiles" )
union!(LOAD_PATH, [userProfilePath])
@time import UserProfiles

println("Setting up sysimage...")
using PackageCompiler
pkgList = [:Distributions, :Joseki, :DataFrames, :CSV, :AWS, :AWSS3, :CreditScoreEstimation, :WalletOptimization, :UserProfiles]
@time create_sysimage(pkgList, sysimage_path="/home/ccg/julia_server/server/sys_server.so", precompile_execution_file="precompile_server.jl", cpu_target="generic")

However, when I try to do this, I get the error message

LoadError: package(s) CreditScoreEstimation, WalletOptimization, UserProfiles not in project

If I remove the packages {:CreditScoreEstimation, :WalletOptimization, :UserProfiles} from the list, it works, but the associated functions are not precompiled (the re-build function takes 10 seconds the first time and 0.3 seconds the second time). My guess is that this is happening because they’re modules and not proper packages. My questions are:

(1) Is there a way to get PackageCompiler.jl to simply precompile modules or even just functions?
(2) If I HAVE to put the code-to-compile into a package, is there a way to do this while having all the source code stored locally without sending this code to a remote repository like Github?
(3) If I HAVE to have the code hosted remotely, is there a way to so this for Bitbucket and not Github?

Hi,
Packages can be (and are by default with the generate command) created fully offline without any link to Github : 5. Creating Packages · Pkg.jl
Basically you just have to put your module file in the good folder structure (a NameOfModule/src/NameOfModule.jl)
You can then add it (or dev it, see 3. Managing Packages · Pkg.jl) to your project so PackageCompiler can find it.

1 Like