Can't precompile dependencies to newly created packages

I’m trying to add package dedendency to newly generated package environment, and if that depencency was not added to my main julia environment, using new package from main environment fails to precompile it. (Windows 10, Julia 1.2)

Steps to reproduce:

  • In REPL:
    ]generate MyPkg
    ]activate MyPkg
    ]add LazyArrays (or any other package instead of LazyArrays that you did NOT added earlier to your main environment)

  • Add using LazyArrays to src\MyPkg.jl

  • In REPL:
    using MyPkg - at this point, using package from its own environment works fine.

  • Restart Julia.

  • In REPL:
    using MyPkg

ERROR: LoadError: ArgumentError: Package LazyArrays [5078a376-72f3-5289-bfd5-ec5146d43c02] is required but does not seem to be installed:
– Run Pkg.instantiate() to install all recorded dependencies.

  • Trying to ]instantiate from main environment doesn’t help. But if I ]activate MyPkg and using MyPkg from its own environment, all looks fine.

Being able to use a new package only from its own environment seems strange to me. Also, there are no errors when adding packages already added to main environment.

You need to add or dev MyPkg in any environment where you want to use it.

So this should work:

>pkg dev path/to/MyPkg
>julia using MyPkg

I am actually surprised that you don’t get an error indicating that MyPkg cannot be found when you issue using MyPkg in a new REPL.

1 Like