Is there a bug in package DataFramesMeta?

Package DataFramesMeta looks very useful. I gave it a try and some things did not work. The following example, copied from [Introduction · DataFramesMeta Documentation], was tried in a new Julia session in an environment where the packages DataFrames and DataFramesMeta had been previously added.

using DataFrames
using DataFramesMeta
df = DataFrame(x = [1, 1, 2, 2], y = [1, 2, 101, 102])
@select(df, :x, :y) # Works fine
4×2 DataFrame
 Row │ x      y     
     │ Int64  Int64
─────┼──────────────
   1 │     1      1
   2 │     1      2
   3 │     2    101
   4 │     2    102
@select(df, :x2 = 2 * :x, :y)
ERROR: LoadError: ArgumentError: This path should not be reached
Stacktrace:
 [1] fun_to_vec(ex::Expr; nolhs::Bool, gensym_names::Bool, wrap_byrow::Bool)
   @ DataFramesMeta C:\Users\fsald\.julia\packages\DataFramesMeta\z0mc6\src\parsing.jl:302
 [2] (::DataFramesMeta.var"#30#31"{Bool})(ex::Expr)
   @ DataFramesMeta .\none:0
 [3] iterate(::Base.Generator{Vector{Any}, DataFramesMeta.var"#30#31"{Bool}}) 
   @ Base .\generator.jl:47
 [4] select_helper(::Symbol, ::Expr, ::Vararg{Any})
   @ DataFramesMeta C:\Users\fsald\.julia\packages\DataFramesMeta\z0mc6\src\macros.jl:976
 [5] var"@select"(__source__::LineNumberNode, __module__::Module, x::Any, args::Vararg{Any})
   @ DataFramesMeta C:\Users\fsald\.julia\packages\DataFramesMeta\z0mc6\src\macros.jl:1078
in expression starting at REPL[10]:1

Is this a bug?

Works fine for me:

julia> @select(df, :x2 = 2 * :x, :y)
4×2 DataFrame
 Row │ x2     y     
     │ Int64  Int64 
─────┼──────────────
   1 │     2      1
   2 │     2      2
   3 │     4    101
   4 │     4    102

(jl_eYtAAA) pkg> st
      Status `/tmp/jl_eYtAAA/Project.toml`
  [1313f7d8] DataFramesMeta v0.10.0

Are you sure you’re on the latest version of DataFramesMeta? Also you don’t need to using DataFrames because DataFramesMeta reexports DataFrames.

I just installed DataFramesMeta. After reading your post I looked and found the following in Project.toml:

DataFramesMeta = "1313f7d8-7da2-5740-9ea0-a2ca25f37964"

Then I did an ] update for the packages in the project. Checked again and the line in Project.toml had not changed. I tried to run the code and got the same error message.

This is in Manifest.toml:

[[deps.DataFramesMeta]]
deps = ["DataFrames", "MacroTools", "Reexport"]
git-tree-sha1 = "b0c9d19eb76bbd5b185bad3a80c447cf8e9404f0"
uuid = "1313f7d8-7da2-5740-9ea0-a2ca25f37964"
version = "0.7.1"

Yes - so as you can see you have DataFramesMeta.jl 0.7.1 installed and the current version is 0.10.0. Please do ]add DataFramesMeta@0.10 to see what is holding back the update of the package to its latest version.

I though ] update would take care of this.

I tried what you suggested with versions 0.10.1, 0.10.0 and 00.11.7 and did not work. Here is what I got:

(BW1) pkg> add DataFramesMeta@0.10.1
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package DataFramesMeta [1313f7d8]:
 DataFramesMeta [1313f7d8] log:
 ├─possible versions are: 0.4.0-0.10.0 or uninstalled
 └─restricted to versions 0.10.1 by an explicit requirement — no versions left

(BW1) pkg> add DataFramesMeta@0.10.0
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package DataFrames [a93c6f00]:
 DataFrames [a93c6f00] log:
 ├─possible versions are: 0.11.7-1.3.2 or uninstalled
 ├─restricted to versions * by an explicit requirement, leaving only versions 0.11.7-1.3.2
 ├─restricted by compatibility requirements with DataFramesMeta [1313f7d8] to versions: 1.0.0-1.3.2
 │ └─DataFramesMeta [1313f7d8] log:
 │   ├─possible versions are: 0.4.0-0.10.0 or uninstalled
 │   └─restricted to versions 0.10.0 by an explicit requirement, leaving only versions 0.10.0
 └─restricted by compatibility requirements with Lathe [38d8eb38] to versions:
 0.11.7-0.22.7 — no versions left
   └─Lathe [38d8eb38] log:
     ├─possible versions are: 0.0.3-0.1.8 or uninstalled
     └─restricted to versions * by an explicit requirement, leaving only versions 0.0.3-0.1.8

(BW1) pkg> add DataFramesMeta@0.11.7
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package DataFramesMeta [1313f7d8]:
 DataFramesMeta [1313f7d8] log:
 ├─possible versions are: 0.4.0-0.10.0 or uninstalled
 └─restricted to versions 0.11.7 by an explicit requirement — no versions left

I also removed DataFramesMeta and reinstalled it with:

] rm DataFramesMeta
add DataFramesMeta

Version 0.7.1 was installed again. I also tried this and DataFramesMeta was not installed.

] rm DataFramesMeta
add DataFramesMeta@0.10.1

It tells you exactly what’s going wrong - you are using Lathe, a package which hasn’t been updated in a long time and is restricted to using a very old DataFrames version (0.22). Given that DataFramesMeta is developed based on the stable, post 1.0 API of DataFrames, all recent DataFramesMeta versions require DataFrames post 1.0.

1 Like

Thanks. I removed package Lathe and that solved the problem. Now the DataFramesMeta code of the original post works.

After a ] update I also saw that the version of the DataFrames package changed to 1.3.2.

The only caveat is that I was only able to install version 0.10.0 of DataFramesMeta. When I tried to install version 0.10.1 I got a short message that does not specify the reason for not installing:

(BW1) pkg> add DataFramesMeta@0.10.1
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package DataFramesMeta [1313f7d8]:
 DataFramesMeta [1313f7d8] log:
 ├─possible versions are: 0.4.0-0.10.0 or uninstalled
 └─restricted to versions 0.10.1 by an explicit requirement — no versions left

That’s because it doesn’t exist - 0.10.0 is the current release

Which is what the error message tells you (possible versions are 0.4.0-0.10.0)