Julia doesn't recognise any installed packages

Hi all,

Quite new to Julia packages so apologies if this is obvious. I’ve been creating and using two packages which are in my dev path. This has been working for a few weeks no problem.

Today, I inserted package1 as a dependency to the project.toml of my second package (DispersionAnalysis) and it appears to have broken everything. Now when running any ‘using’ statement in a testfile.jl I get errors. This is true for my dev packages but also normal installed packages e.g. Plots, Dates, SPICE, etc.

I tried reverting the packages back to no avail. I run my testfile.jl which looks like this:

using Revise
using DispersionAnalysis
... #some code to do dispersion analysis

And the output is:

ERROR: LoadError: ArgumentError: Package Revise [295af30f-e4ad-537b-8983-00126c2a3abe] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.

Stacktrace:
 [1] _require(::Base.PkgId) at .\loading.jl:929
 [2] require(::Base.PkgId) at .\loading.jl:858
 [3] require(::Module, ::Symbol) at .\loading.jl:853
 [4] include_string(::Module, ::String, ::String) at .\loading.jl:1008
 [5] (::getfield(Main._vscodeserver, Symbol("##9#12")){String,Int64,Int64,String})() at c:\Users\calum\.vscode\extensions\julialang.language-julia-0.12.3\scripts\terminalserver\terminalserver.jl:153
 [6] withpath(::getfield(Main._vscodeserver, Symbol("##9#12")){String,Int64,Int64,String}, ::String) at c:\Users\calum\.vscode\extensions\julialang.language-julia-0.12.3\scripts\terminalserver\repl.jl:62
 [7] (::getfield(Main._vscodeserver, Symbol("##8#11")){String,Int64,Int64,String})() at c:\Users\calum\.vscode\extensions\julialang.language-julia-0.12.3\scripts\terminalserver\terminalserver.jl:152
 [8] hideprompt(::getfield(Main._vscodeserver, Symbol("##8#11")){String,Int64,Int64,String}) at c:\Users\calum\.vscode\extensions\julialang.language-julia-0.12.3\scripts\terminalserver\repl.jl:28
 [9] macro expansion at c:\Users\calum\.vscode\extensions\julialang.language-julia-0.12.3\scripts\terminalserver\terminalserver.jl:148 [inlined]
 [10] (::getfield(Main._vscodeserver, Symbol("##7#10")))() at .\task.jl:259
in expression starting at c:\Users\calum\Documents\Git-MissionAnalysis\mission-1\Mission01\MoonMission_auto.jl:2

I ran Instantiate on Pkg DispersionAnalysis

(DispersionAnalysis) pkg> instantiate
  Updating registry at `C:\Users\calum\.julia\registries\General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Installed DelayDiffEq ─────────── v5.14.0
 Installed DifferentialEquations ─ v6.6.0
 Installed OrdinaryDiffEq ──────── v5.15.1
 Installed FFMPEG ──────────────── v0.2.2
 Installed DiffEqBase ──────────── v5.20.1
 Installed MbedTLS ─────────────── v0.7.0
 Installed SparseDiffTools ─────── v0.9.0
 Installed StochasticDiffEq ────── v6.9.1
  Building MbedTLS → `C:\Users\calum\.julia\packages\MbedTLS\a1JFn\deps\build.log`
  Building FFMPEG ─→ `C:\Users\calum\.julia\packages\FFMPEG\9JQpZ\deps\build.log`

Other useful things to know:
Julia v.1.1.
I’ve closed my julia REPL in case it was leftover from another open session,
I’ve re-built and updated all packages.
I’ve also manually checked that the desired packages are installed.

Any ideas how to solve this?

Second, as a more general question, is it ok practise to add one dev package as a dependency of another? I assumed it was fine as they are both issued uuid’s by the package manager.

Thanks!

This seems perhaps too simple, so I’m wondering if I’m missing something here, but it looks like there is nothing that has added Revise to the environment. What happens if you just do ]add Revise in the REPL in whatever environment you are using?

By the way, one of the nice things about Revise is that it does not even have to be listed in whatever package environment you are using to work. I recommend having it in your default environment and initializing it from config/startup.jl (see Revise docs). If you do this, you shouldn’t even have using Revise outside of the startup script.

Yes, it is ok to add one package added with dev as a dependency of another. The only complication with this, is that the location of that package is determined by the Manifest.toml of the environment that you are currently in. So, if you are relying on packages cloned with dev, you will need to make sure you have done dev for all dev packages (even indirect dependencies) in whatever environment you are using. Sadly, I also have to do this all the time, because it is still incredibly difficult to use the package manager with private repositories.

1 Like

Hi ExpandingMan, thanks for the response!

Yes, you are right, I have already included the Revise in my default environment, which i forgot meant I don’t have explicitly add using Revise each script so thanks for the reminder. However, note this problem is happening for any using package statement (standard, dev’d, default or otherwise!)

When I try add package I get this:

(v1.1) pkg> add Revise
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package src [14ec9285]:
 src [14ec9285] log:
 ├─src [14ec9285] has no known versions!
 └─restricted to versions * by an explicit requirement — no versions left

(v1.1) pkg> add Plots
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package src [14ec9285]:
 src [14ec9285] log:
 ├─src [14ec9285] has no known versions!
 └─restricted to versions * by an explicit requirement — no versions left

Something very fishy is going on, are you aware you have a project called src added to your environment? That seems like it may be a mistake. If so, can you try ]rm src?

I suspect what might be going on is that you added the src directory of a package rather than its root directory. Not entirely sure why that’s causing these issues, but it probably thinks it’s missing a Project.toml for that package.

I was not aware of that, and not sure how that could’ve happened!

(v1.1) pkg> rm src
  Updating `C:\Users\calum\.julia\environments\v1.1\Project.toml`
 [no changes]
  Updating `C:\Users\calum\.julia\environments\v1.1\Manifest.toml`
 [no changes]

Is there a way I can see which packages are installed & dev’d in this v1.1 environment?

Yes, use ]status. Note that this only shows direct dependencies. You can also view the Project.toml directly (it’s quite easy to read). Lastly, you can view the Manifest.toml directly.

Ok, so looks like you did indeed have a package named src and it now seems to be removed (it’s confusing that it says “no changes”, but if src were not present as a package, you’d have seen an error).

Did this fix anything? You should at least be able to add packages again.

I re-started the REPL after this. Not many fixes. Now, I run testfile.jl

using DispersionAnalysis #my dev package
using Plots #a standard pkg

I get

ERROR: LoadError: ArgumentError: Package Revise [295af30f-e4ad-537b-8983-00126c2a3abe] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.

Stacktrace:ERROR:
LoadError:  [1] ArgumentError: Package DispersionAnalysis [510672f0-cef4-11e9-1c79-63e8c945e2ea] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.
_require
Stacktrace:(
 [1] _require::(Base.PkgId):: at Base.\loading.jl:929.PkgId)
 at  [2] .\loading.jl:929require
( [2] require::(Base.PkgId):: at Base.\loading.jl:858.PkgId)
 at  [3] .\loading.jl:858require
( [3] require::(Module, ::Module, ::Symbol):: at Symbol.\loading.jl:853)
in expression starting at c:\Users\calum\.vscode\extensions\julialang.language-julia-0.12.3\scripts\terminalserver\terminalserver.jl:450 at
.\loading.jl:853
julia>  [4] include_string(::Module, ::String, ::String) at .\loading.jl:1008
 [5] (::getfield(Main._vscodeserver, Symbol("##9#12")){String,Int64,Int64,String})() at c:\Users\calum\.vscode\extensions\julialang.language-julia-0.12.3\scripts\terminalserver\terminalserver.jl:153
 [6] withpath(::getfield(Main._vscodeserver, Symbol("##9#12")){String,Int64,Int64,String}, ::String) at c:\Users\calum\.vscode\extensions\julialang.language-julia-0.12.3\scripts\terminalserver\repl.jl:62
 [7] (::getfield(Main._vscodeserver, Symbol("##8#11")){String,Int64,Int64,String})() at c:\Users\calum\.vscode\extensions\julialang.language-julia-0.12.3\scripts\terminalserver\terminalserver.jl:152
 [8] hideprompt(::getfield(Main._vscodeserver, Symbol("##8#11")){String,Int64,Int64,String}) at c:\Users\calum\.vscode\extensions\julialang.language-julia-0.12.3\scripts\terminalserver\repl.jl:15
 [9] macro expansion at c:\Users\calum\.vscode\extensions\julialang.language-julia-0.12.3\scripts\terminalserver\terminalserver.jl:148 [inlined]
 [10] (::getfield(Main._vscodeserver, Symbol("##7#10")))() at .\task.jl:259
in expression starting at c:\Users\calum\Documents\Git-MissionAnalysis\mission-1\Mission01\MoonMission_auto.jl:2

I guess this Revise error comes from my config/startup.jl file as the using Revise statement in there is also underlined yellow thus not recognised by VisualStudio/Julia.

Trying again with add I get

(v1.1) pkg> add Revise
 Updating registry at `C:\Users\calum\.julia\registries\General`
 Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package DispersionAnalysis [510672f0]:
DispersionAnalysis [510672f0] log:
├─DispersionAnalysis [510672f0] has no known versions!
└─restricted to versions * by an explicit requirement — no versions left

(v1.1) pkg> add Plots
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package DispersionAnalysis [510672f0]:
DispersionAnalysis [510672f0] log:
├─DispersionAnalysis [510672f0] has no known versions!
└─restricted to versions * by an explicit requirement — no versions left

and running instantiate updates/installs nothing.

so status shows an empty environment.

(v1.1) pkg> status
    Status `C:\Users\calum\.julia\environments\v1.1\Project.toml`
  (empty environment) 

How can this be?

I suspect your Manifest.toml got all screwed up somehow. If I remember correctly, there are ways for this to happen silently. At this point I suggest you delete .julia/environments/v1.1 and start again. Hopefully, as long as you don’t repeat your mistake with adding src as a package, everything will work fine this time.

How frustrating. Thank you for the help! For ease of life how am I supposed to utilise instantiate?

(v1.1) pkg> instantiate
  Updating registry at `C:\Users\calum\.julia\registries\General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`

(v1.1) pkg> activate .

(DispersionAnalysis) pkg> instantiate
  Updating registry at `C:\Users\calum\.julia\registries\General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`

I thought this second call would download all the packages listed in the DispersionAnalysis toml file. Is this incorrect?

Thanks for your help.

No, that’s correct. Of course it will only work for things listed in the Manifest.toml of DispersionAnalysis, so you have to build the environment before instantiate is helpful.

1 Like

Thanks again! I’ll re-install everything and see how I get on.