Hi,
I think I’m doing something wrong when creating packages. When I try to load a package I have created its dependencies are not found unless I also activate the project.
Example:
(v1.1) pkg> generate Test
Generating project Test:
Test\Project.toml
Test/src/Test.jl
(v1.1) pkg> dev Test
[ Info: resolving package specifier `Test` as a directory at `C:\temp\Test`.
Resolving package versions...
Updating `C:\....\.julia\environments\v1.1\Project.toml`
[78f54ab0] + Test v0.1.0 [`..\..\..\..\..\temp\Test`]
Updating `C:\....\.julia\environments\v1.1\Manifest.toml`
[78f54ab0] + Test v0.1.0 [`..\..\..\..\..\temp\Test`]
(v1.1) pkg> activate Test
(Test) pkg> add Distributions ## Note: I have this package installed in my global environment, this is just to add it as a dependency to Test
Updating registry at `C:\.....\.julia\registries\General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
Updating `C:\temp\Test\Project.toml`
[31c24e10] + Distributions v0.20.0
Updating `C:\temp\Test\Manifest.toml`
[List of dependencies omitted for brevity]
### Add "using Distributions" to Test.jl ####
julia> using Test #Works!
[ Info: Precompiling Test [78f54ab0-7c75-11e9-3ad5-f9f36eb15d1f]
julia> Test.greet()
Hello World!
julia> # Exit and try to load the module without activating project
Julia has exited. Press Enter to start a new session.
Starting Julia...
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.1.0 (2019-01-21)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using Test #Fails!
[ Info: Recompiling stale cache file C:\....\.julia\compiled\v1.1\Test\Vq5Bl.ji for Test [78f54ab0-7c75-11e9-3ad5-f9f36eb15d1f]
ERROR: LoadError: ArgumentError: Package Test does not have Distributions in its dependencies:
[stacktrace omitted for brevity]
(v1.1) pkg> activate Test
julia> using Test #Now it works!
[ Info: Precompiling Test [78f54ab0-7c75-11e9-3ad5-f9f36eb15d1f]
julia> Test.greet()
Hello World!
I have tried things like instantiate and adding the project to my “global” environment, but to no avail.