Packages in the Project.toml file are not found in the project

Hi,

I have a project named HeisenbergMBL. While precompiling in the project environment I get the following error,

(HeisenbergMBL) pkg> precompile
Precompiling project...
  ✗ HeisenbergMBL
  0 dependencies successfully precompiled in 3 seconds. 97 already precompiled.

ERROR: The following 1 direct dependency failed to precompile:

HeisenbergMBL [82fe544b-97fe-470f-a1f1-c6b91cdd1d85]

Failed to precompile HeisenbergMBL [82fe544b-97fe-470f-a1f1-c6b91cdd1d85] to /home/20ph92r03/.julia/compiled/v1.8/HeisenbergMBL/jl_xUY0wd.
ERROR: LoadError: ArgumentError: Package Base does not have DelimitedFiles in its dependencies:
- You may have a partially installed environment. Try `Pkg.instantiate()`
  to ensure all packages in the environment are installed.
- Or, if you have Base checked out for development and have
  added DelimitedFiles 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 Base
Stacktrace:
 [1] macro expansion
   @ ./loading.jl:1167 [inlined]
 [2] macro expansion
   @ ./lock.jl:223 [inlined]
 [3] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1144
 [4] include
   @ ./Base.jl:419 [inlined]
 [5] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
   @ Base ./loading.jl:1554
 [6] top-level scope
   @ stdin:1
in expression starting at /scratch/20ph92r03/juliafiles/mpiTest/HeisenbergMBL/src/HeisenbergMBL.jl:3
in expression starting at stdin:1

But the status shows that I have all the libraries installed in the environment.

(HeisenbergMBL) pkg> status
Project HeisenbergMBL v0.1.0
Status `/scratch/20ph92r03/juliafiles/mpiTest/HeisenbergMBL/Project.toml`
  [31c24e10] Distributions v0.25.80
⌅ [da04e1cc] MPI v0.19.2
  [5be22e1c] PetscWrap v0.1.5
  [3c0b384b] QuantumInformation v0.4.9
  [c3679e3b] SlepcWrap v0.1.3
  [8bb1440f] DelimitedFiles
  [37e2e46d] LinearAlgebra
  [10745b16] Statistics
Info Packages marked with ⌅ have new versions available but cannot be upgraded. To see why use `status --outdated`

I tried Pkg.resolve() and Pkg.instantiate() but the error persists. Here is how my Project.toml file looks like

name = "HeisenbergMBL"
uuid = "82fe544b-97fe-470f-a1f1-c6b91cdd1d85"
authors = ["devanshu <devanshu2096@gmail.com>"]
version = "0.1.0"

[deps]
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
PetscWrap = "5be22e1c-01b5-4697-96eb-ef9ccdc854b8"
QuantumInformation = "3c0b384b-479c-5684-b2ef-9d7a46dd931e"
SlepcWrap = "c3679e3b-785e-4ccc-b734-b7685cbb935e"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[extras]
MPIPreferences = "3da0fdf6-3ccc-4f1b-acd9-58baa6c99267"

[preferences.MPIPreferences]
_format = "1.0"
abi = "MPICH"
binary = "system"
libmpi = "libmpi"
mpiexec = "mpiexec"

I am not sure what the error is.

Thanks.

This could be because you have code outside of the module HeisenbergMBL ... end, see JuliaLang/julia#45832.

Hey, Thanks!

One more thing, why do I get a Package not found error when I run the code setting export JULIA_LOAD_PATH=["@","@stdlib"], since I want Julia to only consider the packages and versions installed in the environment.

I think you are expected to use colon as the separator, see the docs. So maybe export JULIA_LOAD_PATH="@:@stdlib" in your case.

Check what Base.LOAD_PATH is after you start julia and make sure that seems correct.