Same command works in Jupyter and REPL but not in Vscode

I am using this command to import a csv file.

zhvi = CSV.File("data/zhvi.csv") |> DataFrame

It works in Jupyter and REPL (when I create a new folder) but in Vscode (using an environment that results from cloning a repository) gives this error:

ERROR: MethodError: no method matching typesubtract(::Type{Union{}}, ::Type{Int64})
Closest candidates are:
  typesubtract(::Any, ::Any, ::Int64) at compiler/typeutils.jl:70
Stacktrace:
 [1] ts(T::Type, S::Type)
   @ CSV ~\.julia\packages\CSV\MKemC\src\utils.jl:214
 [2] nonstandardtype(T::Type)
   @ CSV ~\.julia\packages\CSV\MKemC\src\utils.jl:217
 [3] (::CSV.var"#17#23")(T::Type)
   @ CSV .\none:0
 [4] iterate(::Base.Iterators.Filter{CSV.var"#17#23", Vector{Type}})
   @ Base.Iterators .\iterators.jl:451
 [5] iterate
   @ .\generator.jl:44 [inlined]
 [6] CSV.Header(source::String, header::Int64, normalizenames::Bool, datarow::Int64, skipto::Nothing, footerskip::Int64, transpose::Bool, comment::Nothing, use_mmap::Nothing, ignoreemptylines::Bool, select::Nothing, drop::Nothing, missingstrings::Vector{String}, missingstring::String, delim::Nothing, ignorerepeated::Bool, quotechar::Char, openquotechar::Nothing, closequotechar::Nothing, escapechar::Char, dateformat::Nothing, dateformats::Nothing, decimal::UInt8, truestrings::Vector{String}, falsestrings::Vector{String}, type::Nothing, types::Nothing, typemap::Dict{Type, Type}, categorical::Nothing, pool::Float64, lazystrings::Bool, strict::Bool, 
silencewarnings::Bool, debug::Bool, parsingdebug::Bool, streaming::Bool)
   @ CSV ~\.julia\packages\CSV\MKemC\src\header.jl:232
 [7] CSV.File(source::String; header::Int64, normalizenames::Bool, datarow::Int64, skipto::Nothing, footerskip::Int64, transpose::Bool, comment::Nothing, use_mmap::Nothing, ignoreemptylines::Bool, select::Nothing, drop::Nothing, missingstrings::Vector{String}, missingstring::String, delim::Nothing, ignorerepeated::Bool, quotechar::Char, openquotechar::Nothing, closequotechar::Nothing, escapechar::Char, dateformat::Nothing, dateformajulia> zhvi = CSV.File("data/zhvi.csv") |> DataFrame
ERROR: MethodError: no method matching typesubtract(::Type{Union{}}, ::Type{Int64})
Closest candidates are:
  typesubtract(::Any, ::Any, ::Int64) at compiler/typeutils.jl:70
Stacktrace:
 [1] ts(T::Type, S::Type)
   @ CSV ~\.julia\packages\CSV\MKemC\src\utils.jl:214
 [2] nonstandardtype(T::Type)
   @ CSV ~\.julia\packages\CSV\MKemC\src\utils.jl:217
 [3] (::CSV.var"#17#23")(T::Type)
   @ CSV .\none:0
 [4] iterate(::Base.Iterators.Filter{CSV.var"#17#23", Vector{Type}})
   @ Base.Iterators .\iterators.jl:451
 [5] iterate
   @ .\generator.jl:44 [inlined]
 [6] CSV.Header(source::String, header::Int64, normalizenames::Bool, datarow::Int64, skipto::Nothing, footerskip::Int64, transpose::Bool, comment::Nothing, use_mmap::Nothing, ignoreemptylines::Bool, select::Nothing, drop::Nothing, missingstrings::Vector{String}, missingstring::String, delim::Nothing, ignorerepeated::Bool, quotechar::Char, openquotechar::Nothing, closequotechar::Nothing, escapechar::Char, dateformat::Nothing, dateformats::Nothing, decimal::UInt8, truestrings::Vector{String}, falsestrings::Vector{String}, type::Nothing, types::Nothing, typemap::Dict{Type, Type}, categorical::Nothing, pool::Float64, lazystrings::Bool, strict::Bool, 
silencewarnings::Bool, debug::Bool, parsingdebug::Bool, streaming::Bool)
   @ CSV ~\.julia\packages\CSV\MKemC\src\header.jl:232
 [7] CSV.File(source::String; header::Int64, normalizenames::Bool, datarow::Int64, skipto::Nothing, footerskip::Int64, transpose::Bool, comment::Nothing, use_mmap::Nothing, ignoreemptylines::Bool, select::Nothing, drop::Nothing, missingstrings::Vector{String}, missingstring::String, delim::Nothing, ignorerepeated::Bool, quotechar::Char, openquotechar::Nothing, closequotechar::Nothing, escapechar::Char, dateformat::Nothing, dateformats::Nothing, decimal::UInt8, truestrings::Vector{String}, falsestrings::Vector{String}, type::Nothing, types::Nothing, typemap::Dict{Type, Type}, categorical::Nothing, pool::Float64, lazystrings::Bool, strict::Bool, silencewarnings::Bool, debug::Bool, parsingdebug::Bool, kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ CSV ~\.julia\packages\CSV\MKemC\src\file.jl:216
 [8] CSV.File(source::String)
   @ CSV ~\.julia\packages\CSV\MKemC\src\file.jl:216
 [9] top-level scope
   @ REPL[4]:1

So in VS Code you have CSV.jl version 0.7.7 (you can see that in ~/.julia/packages/CSV/MKemC/Project.toml). I guess in the REPL you are using a more recent version? In that case I suggest you try to update CSV.jl in your VS Code environment.

1 Like