Precompiling a code when first upgrading from v0.6 to v0.7

Hi everyone,

I’m trying to move my unregistered package from julia 0.6 to 0.7, following this guide. After creating a v0.6 tag, I installed my package on julia 0.7 as such:

(v0.7) pkg> add GitHub - OpenMendel/MendelIHT.jl: Iterative hard thresholding for l0 penalized regression

which created a 2 folders:

  • /Users/biona001/.julia/dev/IHT
  • /Users/biona001/.julia/packages/IHT/xoihb

Then I try to precompile my 0.6 code on 0.7 which does not work:

julia> using IHT
[ Info: Precompiling IHT [921c7187-1484-5754-b919-5d3ed9ac03c4]
┌ Warning: Package IHT does not have PLINK in its dependencies:
│ - If you have IHT checked out for development and have
│ added PLINK as a dependency but haven’t updated your primary
│ environment’s manifest file, try Pkg.resolve().
│ - Otherwise you may need to report an issue with IHT
└ Loading PLINK into IHT from project dependency, future warnings for IHT are suppressed.
WARNING: importing deprecated binding Base.mean into PLINK.
WARNING: importing deprecated binding Base.A_mul_B! into PLINK.
WARNING: importing deprecated binding Base.At_mul_B! into PLINK.
WARNING: importing deprecated binding Base.Pkg into PLINK.
WARNING: Base.Pkg is deprecated, run using Pkg instead
likely near /Users/biona001/.julia/packages/PLINK/InWqw/src/PLINK.jl:107
ERROR: LoadError: MethodError: no method matching dir()
Closest candidates are:
dir(::String, ::AbstractString…) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/Pkg/src/API.jl:454
Stacktrace:
[1] top-level scope at none:0
[2] include at ./boot.jl:317 [inlined]
[3] include_relative(::Module, ::String) at ./loading.jl:1038
[4] include(::Module, ::String) at ./sysimg.jl:29
[5] top-level scope at none:2
[6] eval at ./boot.jl:319 [inlined]
[7] eval(::Expr) at ./client.jl:399
[8] top-level scope at ./none:3
in expression starting at /Users/biona001/.julia/packages/PLINK/InWqw/src/PLINK.jl:107
ERROR: LoadError: Failed to precompile PLINK [26d038ce-b445-5f8f-b3cd-3ed5786e5252] to /Users/biona001/.julia/compiled/v0.7/PLINK/3V3xJ.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] macro expansion at ./logging.jl:313 [inlined]
[3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1185
[4] _require(::Base.PkgId) at ./logging.jl:311
[5] require(::Base.PkgId) at ./loading.jl:852
[6] macro expansion at ./logging.jl:311 [inlined]
[7] require(::Module, ::Symbol) at ./loading.jl:834
[8] include at ./boot.jl:317 [inlined]
[9] include_relative(::Module, ::String) at ./loading.jl:1038
[10] include(::Module, ::String) at ./sysimg.jl:29
[11] top-level scope at none:2
[12] eval at ./boot.jl:319 [inlined]
[13] eval(::Expr) at ./client.jl:399
[14] top-level scope at ./none:3
in expression starting at /Users/biona001/.julia/packages/IHT/xoihb/src/IHT.jl:4
ERROR: Failed to precompile IHT [921c7187-1484-5754-b919-5d3ed9ac03c4] to /Users/biona001/.julia/compiled/v0.7/IHT/eaqWB.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] macro expansion at ./logging.jl:313 [inlined]
[3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1185
[4] _require(::Base.PkgId) at ./logging.jl:311
[5] require(::Base.PkgId) at ./loading.jl:852
[6] macro expansion at ./logging.jl:311 [inlined]
[7] require(::Module, ::Symbol) at ./loading.jl:834

The next step should be updating my v0.6 syntax to v0.7. However, I’m not sure why is Julia 0.7 trying to precompile my code in /Users/biona001/.julia/packages/IHT/xoihb/src directory instead of the one inside the .julia/dev/ directory? Should I be editing the code in .julia/packages/IHT/xoihb directly? And should my git track this particular subfolder?

I apologise in advance if this information is hidden somewhere in the documentation or stackexchange… but I’ve not been able to successfully precompile my code in 0.7 for 3 days now, and I still don’t know why…

No, and no. If you want to develop a package, you need to tell the package manager to develop it. That is, you need to do:

pkg> dev IHT

which will tell Julia to load the IHT package from .julia/dev/IHT instead of .juila/packages/IHT. You can then work on your code inside the dev folder and commit it as usual. Note that pkg> add does not create that dev entry, so perhaps you already tried to dev IHT some time in the past while upgrading to 0.7?

You can read more about using the dev command here: Pkg · The Julia Language

As for the particular error you’re seeing, it’s probably because you were calling Pkg.dir("some package name"), which is no longer defined (because it no longer has an unambiguous answer in the new package manager). Fortunately, almost all uses of Pkg.dir in my experience were easy to replace with uses of @__DIR__ and/or @__FILE__.

Hi, thanks for the reply.

So I realized that working with an unregistered package is what caused most of the hassle. Basically you need to develop an unregistered package like:

] dev https://github.com/biona001/IHT.jl.

which was not in the documentation, unfortunately. For other trouble shooting, I found this post helpful.

For future reference, I believe the code inside the .julia/packages/xxxx/your-package is supposed to be an environment - that is, a final code product that is there for reproducibility, and you shouldn’t be editing that code.