Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkgdir(@__MODULE__) returns nothing during __init__ on 1.11.0 #56077

Open
SBuercklin opened this issue Oct 9, 2024 · 17 comments
Open

pkgdir(@__MODULE__) returns nothing during __init__ on 1.11.0 #56077

SBuercklin opened this issue Oct 9, 2024 · 17 comments
Labels
bug Indicates an unexpected problem or unintended behavior regression 1.11 Regression in the 1.11 release

Comments

@SBuercklin
Copy link
Contributor

SBuercklin commented Oct 9, 2024

On Julia 1.11.0, generating a new package whose src/MWE.jl is just the following, where we print the pkgdir for the current @__MODULE__:

module MWE

greet() = print("Hello World!")

function __init__()
    println(@__MODULE__)
    println(pkgdir(@__MODULE__))
end

end # module MWE

produces the following when being loaded (note the nothing for pkgdir):

julia> using MWE
[ Info: Precompiling MWE [07383931-b36a-4268-bd90-eec35e6fd057]
MWE
nothing

However, on Julia 1.10.5, the proper directory is printed:

julia> using MWE
  No Changes to `/tmp/tmp.s4wO5AcljZ/MWE/Project.toml`
  No Changes to `/tmp/tmp.s4wO5AcljZ/MWE/Manifest.toml`
Precompiling MWE
  1 dependency successfully precompiled in 1 seconds
MWE
/tmp/tmp.s4wO5AcljZ/MWE
@SBuercklin SBuercklin changed the title pkgdir(@__MODULE__) returns nothing during __init__ on 1.11 pkgdir(@__MODULE__) returns nothing during __init__ on 1.11.0 Oct 9, 2024
@fatteneder
Copy link
Member

Appears on 1.11.0-rc2 but not on 1.11.0-rc1, currently bisecting commits.

@fatteneder
Copy link
Member

Bisected to 19f838f/#54739

@thchr
Copy link
Contributor

thchr commented Oct 25, 2024

Just noting here that this is very likely responsible for JuliaIO/JLD2.jl#610, which makes it impossible to JLD2-load variables in __init__ whose types are defined in the package itself.

@IanButterworth IanButterworth added bug Indicates an unexpected problem or unintended behavior regression 1.11 Regression in the 1.11 release labels Oct 25, 2024
@IanButterworth
Copy link
Member

Can we see if this is fixed on nightly. It might be that we need to backport something. There's been a lot of loading tweaks on master.

@fatteneder
Copy link
Member

I tried yesterday using nightly but it was still not working.

@IanButterworth
Copy link
Member

@vtjnash I'm guessing pkgorigins is set after the inits have run?

@IanButterworth
Copy link
Member

@fatteneder I just tried this on nightly 4c076c8 and it worked?

The active project was the MWE package, and there's no Manifest so the old serial precompile path is used.

julia> using MWE
[ Info: Precompiling MWE [07383931-b36a-4268-bd90-eec35e6fd057]
MWE
/Users/ian/Documents/GitHub/mwe

@fatteneder
Copy link
Member

Its now working too. I might have forgotten to update the nightly channel before testing. Sorry.

@IanButterworth
Copy link
Member

Any idea which commit you were on?

@fatteneder
Copy link
Member

I fear not, because I just updated it since juliaup showed that its outdated ...

@fatteneder
Copy link
Member

fatteneder commented Nov 1, 2024

Ok, I have two .ji caches which contain these commits:

So I guess I was still on the first one...

@IanButterworth
Copy link
Member

Just bisected the fix to #56329

@KristofferC
Copy link
Member

I don't understand why you would call this at __init__ instead of during precompile time?

@MichaelAguadze
Copy link

I added the DiffEqGPU.jl package but failing to precompile on M1 pro.
Image

@fatteneder

This comment has been minimized.

@KristofferC
Copy link
Member

KristofferC commented Dec 1, 2024

@fatteneder looks like the same issue, no?

@MichaelAguadze,i think that should have been fixed by JuliaGPU/GPUCompiler.jl#589 so maybe you need to update the version.

@fatteneder

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior regression 1.11 Regression in the 1.11 release
Projects
None yet
Development

No branches or pull requests

6 participants