Missing source file for local package

I have a module I am developing using Visual Studio Code on a Win 10 virtual machine. It is working fine. The source code is in a GitHub repository. I have cloned this repository to a different Win 10 virtual machine to the same relative location, namely ~/.julia/registries/PIPCore.jl. The name of the package is “PIPCore”.

If I open this folder in VSC, and try to instantiate the environment, I get the following error:

> (PIPCore) pkg> instantiate
>   0 dependencies successfully precompiled in 4 seconds (124 already precompiled)
>   1 dependency errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the package

When I run

import Pkg; Pkg.precompile()

I get the following error:

julia> import Pkg; Pkg.precompile()
  0 dependencies successfully precompiled in 2 seconds (124 already precompiled)

ERROR: The following 1 direct dependency failed to precompile:

PIPCore [5f73200a-36c0-42cd-9607-31bc8d8705ce]

Error: Missing source file for PIPCore [5f73200a-36c0-42cd-9607-31bc8d8705ce

When I look at the LOAD_PATH and DEPOT_PATH constants, there is no obvious difference between the two VMs.
pwd() in both cases points to the directory ~/.julia/registries/PIPCore.jl with Project.toml file for this project. the source code is in src subdirectory.

I don’t know how to fix this, please help.

Errrr… am I mistaken or do you expect the directory ~/.julia to have exactly the same contents on each virtual machine?
By the way, Windows users would see this as C:\Users]your_username.julia

Yes, I used ~ just to simplify the path, it is actually:

C:\\Users\\kherbstadmin\\.julia\\registries\\PIPCore.jl

and the content of these directories are identical on the two VMs. I don’t know whether it is relevant, but the VM without the problem runs Win 10, and the one with the problem runs Windows Server 2019. On the Win 10 machine Julia 1.6.2 is installed using juliaup, whereas on the second machine it is installed manually.

Are you synchronising the contents of that directory between the two machines?

The difference in OS may be significant. There was an issue in permissions with Windows in the pre 1.0 era of Julia - I cannot remember the exact issue but you had to grant users some privileges.

I am not synchronising the contents directly, the original machine updated the source on GitHub, and I cloned the directory from GitHub to the second machine. The PIPCore.jl source file for the module is present in both cases and I have full permission to the directory. The operating system is an obvious difference, but I don’t see how it is related to this problem and what I can do to resolve the issue.

I’m not sure where that path came from but it doesn’t make any sense as a package location. My guess is that you have it correctly installed elsewhere (in ~/.julia/packages at the right location, which depends on the exact version) on the system that works and maybe also incidentally at ~/.julia/registries/PIPCore.jl, probably because you cloned it there manually since the package manager doesn’t install packages there.

2 Likes

I am probably not explaining things properly. I am not trying to install the PIPCore package, but continue the development of the PIPCore.jl module that I started on the original VM.

What I have done now is to uninstall Julia, making sure I delete the original folder it was in completely, and re-install it, accepting the default installation location: C:\Users\my_username\AppData\Local\Programs\Julia-1.6.2

I then cloned the source code from GitHub to E:\Source\ where it now resides in E:\Source\PIPCore.jl.

I launched Visual Studio Code and opened this folder. I started the Julia REPL.

julia> pwd()
"E:\\Source\\PIPCore.jl"

I then :

(PIPCore) pkg> instantiate
Precompiling project...
  ✓ Revise
  112 dependencies successfully precompiled in 74 seconds (12 already precompiled)
  1 dependency precompiled but a different version is currently loaded. Restart julia to access the new version
  1 dependency errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the package

I restarted VSC as instructed (Restart julia to access the new version) , and started Julia REPL

julia> import Pkg; Pkg.precompile()
  0 dependencies successfully precompiled in 5 seconds (124 already precompiled)

ERROR: The following 1 direct dependency failed to precompile:

PIPCore [5f73200a-36c0-42cd-9607-31bc8d8705ce]

Error: Missing source file for PIPCore [5f73200a-36c0-42cd-9607-31bc8d8705ce
Stacktrace:
 [1] pkgerror(msg::String)
   @ Pkg.Types C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Types.jl:55
 [2] precompile(ctx::Pkg.Types.Context; internal_call::Bool, strict::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:1265
 [3] precompile
   @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:921 [inlined]
 [4] #precompile#196
   @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:919 [inlined]
 [5] precompile()
   @ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:919
 [6] top-level scope
   @ REPL[2]:1

Inside the E:\Source\PIPCore.jl directory is the src subdirectory with the PIPCore source code :

module PIPCore

# using statements

#export statement

#some code

include("staging.jl")

end

staging.jl is in the same src sub-directory.

Project.toml:

name = "PIPCore"
uuid = "5f73200a-36c0-42cd-9607-31bc8d8705ce"
authors = ["Kobus Herbst"]
version = "0.1.0"

[deps]
...

To the best of my knowledge these are the steps to follow to continue working on Julia source code, this procedure worked for me before, I can’t figure out why it doesn’t now.

Try ]resolve before ] instantiate.

I tried it:

(PIPCore) pkg> resolve
  No Changes to `E:\Source\PIPCore.jl\Project.toml`
  No Changes to `E:\Source\PIPCore.jl\Manifest.toml`

(PIPCore) pkg> instantiate
  0 dependencies successfully precompiled in 3 seconds (124 already precompiled)
  1 dependency errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the package

On the same machine I created a test package using PackageTemplates, no problem with using the test package. However, PIPCore was originally created with PackageTemplates and the code has the same basic layout.

What is the main package file in src called?

2 Likes

Actually PIPCORE.jl, changed it to PIPCore.jl, problem solved.

Thank you so much, lesson learned that perhaps in Win 10 file name resolution is not case sensitive, but case sensitive in Windows Server.

2 Likes