DataFramesMeta.jl icon indicating copy to clipboard operation
DataFramesMeta.jl copied to clipboard

subset not defined

Open wizofe opened this issue 2 years ago • 12 comments

On a clean environment with DataFramesMeta and Julia 1.7.2 I am getting this error:

UndefVarError: subset not defined

Any idea why?

wizofe avatar Feb 08 '22 20:02 wizofe

Interesting. Thank you for reporting! I will debug.

pdeffebach avatar Feb 08 '22 21:02 pdeffebach

Specifically, this is the error I am getting:

UndefVarError: subset not defined

    subset_helper(::Symbol, ::Expr)@macros.jl:427
    var"@subset"(::LineNumberNode, ::Module, ::Any, ::Vararg{Any})@macros.jl:577
    #macroexpand#[email protected]:115[inlined]
    [email protected]:114[inlined]
    try_macroexpand(::Module, ::Base.UUID, ::Expr)@PlutoRunner.jl:253
    var"#run_expression#25"(::Bool, ::typeof(Main.PlutoRunner.run_expression), ::Module, ::Expr, ::Base.UUID, ::Nothing, ::Nothing)@PlutoRunner.jl:482
    top-level scope@none:1

wizofe avatar Feb 08 '22 21:02 wizofe

I cannot replicate. Can you list the output of import Pkg; Pkg.status()?

pdeffebach avatar Feb 08 '22 21:02 pdeffebach

julia> Pkg.status()
      Status `~/Projects/EDA/Project.toml`
  [336ed68f] CSV v0.10.2
  [159f3aea] Cairo v1.0.5
  [35d6a980] ColorSchemes v3.17.0
  [a93c6f00] DataFrames v1.3.2
  [1313f7d8] DataFramesMeta v0.10.0
  [31c24e10] Distributions v0.25.46
  [c91e804a] Gadfly v1.3.4
  [c27321d9] Glob v1.3.0
  [09f84164] HypothesisTests v0.10.6
  [a3a9e032] NIfTI v0.5.6
  [c3e4b0f8] Pluto v0.18.0
  [2913bbd2] StatsBase v0.33.14
  [10745b16] Statistics

But I am using Pluto, so those may not be the exact versions Pluto is using.

wizofe avatar Feb 08 '22 21:02 wizofe

Uh oh.

Please confirm if it works on a normal REPL. I will install Pluto and see if I can replicate.

pdeffebach avatar Feb 08 '22 21:02 pdeffebach

Ok here's what Pluto is using:

  [e1450e63] BufferedStreams v1.0.0
  [336ed68f] CSV v0.8.5
  [a93c6f00] DataFrames v0.22.7
  [1313f7d8] DataFramesMeta v0.8.0
  [c91e804a] Gadfly v1.3.4
  [c27321d9] Glob v1.3.0
  [09f84164] HypothesisTests v0.10.6
  [a3a9e032] NIfTI v0.5.6
  [7f904dfe] PlutoUI v0.7.1
  [44cfe95a] Pkg
  [10745b16] Statistics

wizofe avatar Feb 08 '22 21:02 wizofe

That's an incredibly old version of DataFrames.jl.

I'm still confused about subset. I would have hoped a DataFramesMeta.jl vrsion which supports @subset wouldn't be compatible with a DataFrames.jl version which does not support subset.

Nonetheless, this is definitely a Pluto.jl problem. They should not be downgrading to packages that are over a year old. Can you see why Pluto is downgrading?

pdeffebach avatar Feb 08 '22 21:02 pdeffebach

Yes, I've just noticed as I pasted this. WOW. I am not sure how to check why the package is being downgraded. Any tips on that?

In any case thanks for your time, I will definitely post this over there.

Meanwhile I found that by doing Pkg.activate() in the start of the notebook I can use my package's environment and ignore Pluto package management.

wizofe avatar Feb 08 '22 21:02 wizofe

Okay I can confirm I did not do my due-diligence in compatability bounds when releasing DataFramesMeta.jl version 0.8.0. So that part of the error is on me. But given we have moved on to post DataFrames 1.0, I'm not sure the benefit of trying to backport a compatability change, or even if its possible.

I will still download Pluto and take a look!

pdeffebach avatar Feb 08 '22 21:02 pdeffebach

Try doing add [email protected] in Pluto.jl and you will see what is holding back installation of latest DataFrames.jl.

bkamins avatar Feb 08 '22 22:02 bkamins

I can't replicate on a fresh Pluto install. The newest versions install just fine.

My know that Pluto stores it's own Project.toml in a way that is slightly hidden from the user. So my guess is that your notebook is somewhat old, and these versions are cached.

Somehow to avoid making a breaking change, you ended up with a version of DataFramesMeta which was bad (which, again, was my fault). Try updating the packages within Pluto and see if that fixes things.

pdeffebach avatar Feb 09 '22 15:02 pdeffebach

For the moment I skipped Pluto's reproducible approach by creating a local project and using my own toml, using the following:

begin
    import Pkg
    # careful: this is _not_ a reproducible environment
    # activate the global environment
    Pkg.activate(Base.current_project())

    Pkg.instantiate()
end

So according to the Pluto wiki apparently the toml is saved inside the Pluto notebook (either .jl or .Jmd). Interesting! I will try removing all the dependencies and test if that changes the issue. Thank you :)

wizofe avatar Feb 10 '22 12:02 wizofe