Skip to content
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

How to use separate cache in Julia 0.7? #173

Open
tkf opened this issue Jul 31, 2018 · 4 comments
Open

How to use separate cache in Julia 0.7? #173

tkf opened this issue Jul 31, 2018 · 4 comments

Comments

@tkf
Copy link
Member

tkf commented Jul 31, 2018

While writing #172, I realized that it won't work in Julia 0.7 since the cache directory structure is completely different. In Julia 0.7 it's ~/.julia/compiled/v0.7/{package name}/{slug}.ji and this is the code that locates the path:

cache_file_entry(pkg::PkgId) = joinpath(
    "compiled",
    "v$(VERSION.major).$(VERSION.minor)",
    pkg.uuid === nothing ? "$(pkg.name).ji" : joinpath(pkg.name, "$(package_slug(pkg.uuid)).ji")
)

function find_all_in_cache_path(pkg::PkgId)
    paths = String[]
    entry = cache_file_entry(pkg)
    for depot in DEPOT_PATH
        path = joinpath(depot, entry)
        isfile_casesensitive(path) && push!(paths, path)
    end
    return paths
end

--- https://github.com/JuliaLang/julia/blob/7a8459972e28fa1adf01a9c6d8d1227ec05a09d8/base/loading.jl#L594-L608

In principle, I guess we can do a similar trick we do with Base.LOAD_CACHE_PATH in 0.6 with Base.DEPOT_PATH in 0.7. But creating a depot for each Python version sounds like a overkill since it has more than a cache directory. Here is how they describe Base.DEPOT_PATH:

The first entry is the “user depot” and should be writable by and owned by the current user. The user depot is where: registries are cloned, new package versions are installed, named environments are created and updated, package repos are cloned, newly compiled package image files are saved, log files are written, development packages are checked out by default, and global configuration data is saved. Later entries in the depot path are treated as read-only and are appropriate for registries, packages, etc. installed and managed by system administrators.

--- https://docs.julialang.org/en/latest/stdlib/Pkg/

So, what is the best way to support multiple Python interpreters in Julia 0.7?

@Keno
Copy link
Contributor

Keno commented Aug 1, 2018

cc @StefanKarpinski

@stevengj
Copy link
Member

stevengj commented Aug 1, 2018

Also cc @KristofferC

@tkf
Copy link
Member Author

tkf commented Aug 1, 2018

@stevengj I wrote this before reading your comment #172 (comment). Now that I understand it is only for switching between Python 2 and 3, I don't feel like this is a major issue anymore. Many users won't be using Python 2 anyway (hopefully). I'm closing it now. (But please reopen it if you think it is still a major issue.)

@tkf tkf closed this as completed Aug 1, 2018
@tkf
Copy link
Member Author

tkf commented Aug 1, 2018

Oops. I was wrong. Separated compilation cache is required even for supporting just one Python interpreter. Reopening it...

e.g., in Linux when statically linked:

use_separate_cache = exe_differs or determine_if_statically_linked()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants