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

Julia VS Code extension reports "Possible method call error" for fit! #268

Open
Yue-Zhengyuan opened this issue Nov 26, 2023 · 3 comments
Open

Comments

@Yue-Zhengyuan
Copy link

I write the following small program to ask input numbers from user, and calculate the mean and variance.

using OnlineStats

function calculate_average()
    o = Series(Mean(), Variance())
    println(typeof(o))
    i = 0
    while true
        println("Enter number or 'q' to quit:")
        input = readline()
        if input == "q"
            break
        else
            x = parse(Float64, input)
            fit!(o, x)
            i += 1
            println(value(o))
        end
    end
end

calculate_average()

But the Julia VS Code extension reports "Possible method call error" at fit!(o, x). It thinks fit! as StatsAPI.fit!, and reports it is a "function with 0 methods"


System information:

  • OnlineStats: 1.6.3
  • VS Code: 1.84.2
  • Julia extension: 1.60.2
  • Julia: 1.9.4
  • OS: macOS 14.0
@joshday
Copy link
Owner

joshday commented Nov 27, 2023

My system looks just like yours, but I can't reproduce this.

@Yue-Zhengyuan
Copy link
Author

Here are the packages I installed. I wonder if any of them interferes with the VS Code extension.

(@v1.9) pkg> status
Status `~/.julia/environments/v1.9/Project.toml`
  [c7e460c6] ArgParse v1.1.4
  [6e4b80f9] BenchmarkTools v1.3.2
  [d360d2e6] ChainRulesCore v1.18.0
  [8a292aeb] Cuba v2.3.0
  [864edb3b] DataStructures v0.18.15
  [cc61a311] FLoops v0.2.1
  [6a86dc24] FiniteDiff v2.21.1
  [92c85e6c] GSL v1.0.1
  [7073ff75] IJulia v1.24.2
  [c8e1da08] IterTools v1.8.0
  [033835bb] JLD2 v0.4.38
  [682c06a0] JSON v0.21.4
  [0b1a1467] KrylovKit v0.6.0
  [b964fa9f] LaTeXStrings v1.3.1
  [8fca5bbe] MultiQuad v1.3.1
  [15e1cf62] NPZ v0.4.3
  [ebe7aa44] OMEinsum v0.7.5
  [5fb14364] OhMyREPL v0.5.23
  [a15396b6] OnlineStats v1.6.3
  [429524aa] Optim v1.7.8
⌃ [bac558e1] OrderedCollections v1.6.2
  [d96e819e] Parameters v0.12.3
⌃ [e0809bc7] Permanents v0.1.1
  [49802e3a] ProgressBars v1.5.1
  [438e738f] PyCall v1.96.2
  [d330b81b] PyPlot v2.11.2
  [2913bbd2] StatsBase v0.34.2
  [07d1fe3e] TensorKit v0.12.0
  [6aa20fa7] TensorOperations v4.0.7
  [3a884ed6] UnPack v1.0.2
  [e88e6eb3] Zygote v0.6.67

@adknudson
Copy link

I often run into a similar issue, and can fix it by explicitly importing the fit! method

using OnlineStats
using OnlineStats: fit!

I think the issue usually comes from using extended methods, i.e. because fit! is imported/owned by StatsBase. Seems to be a general limitation of the VSCode extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants