Instantiate does not instantiate?

I’m playing with some student code, and the following is happening: while there is a Manifest.toml file and it seems to contain all the packages, instantiate does nothing:

shell> ls
 config.jl       'ddt_polipart!.jl'   geradist.jl     Manifest.toml   Project.toml   Run_polipart.jl   Solve_BV2.jl
 Configsimul.jl  'ddt_regsol_4!.jl'   jacpattern.jl   Mataux.jl       projeto_1D     Salvasimul.jl    'Solve_BV!.jl'

shell> grep DifferentialEquations Manifest.toml
[[deps.DifferentialEquations]]

(projeto_1D) pkg> instantiate

julia> using DifferentialEquations
 │ Package DifferentialEquations not found, but a package named DifferentialEquations is available from a registry. 
 │ Install package?
 │   (projeto_1D) pkg> add DifferentialEquations 
 └ (y/n/o) [y]: n
ERROR: ArgumentError: Package DifferentialEquations not found in current path.
- Run `import Pkg; Pkg.add("DifferentialEquations")` to install the DifferentialEquations package.

What may be happening here?

The Project.toml file seems fine as well.

Is DifferentialEquations listed as a direct dependency in Project.toml? That error has nothing to do with Manifest.toml or instantiation.

1 Like

The code is not mine, so I will answer you in a private message to add further info. But for that specific question the answer is yes, it is listed.

I think the problem is somehow related to uppercase, lowercase, or underscore characters, as the code came from a Windows machine. I have reorganized the directory structure and now it is working, but there may be an underlying issue there.

Oh, no, I see what was going on. The script of the student started with

import Pkg; Pkg.activate("ProjectName")

but when coding from VSCode, ProjectName was already active, such that that first line of the script created a subproject, and that messed up everything when it came to executing stuff.

If the intention is to activate the project in the same directory as the script, I’d strongly recommend doing Pkg.activate(@__DIR__).

2 Likes