Yining Wang
Yining Wang

Reputation: 101

Cannot load Plot package in Julia

I am using Julia on a Mac laptop. Everything worked fine until yesterday when I want to do some plots I can no longer import the Plots package. When I try to do Using Plots, I receive the following error message:

[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] ERROR: LoadError: MethodError: no method matching floatrange(::Type{Float64}, ::Int64, ::Int64, ::Float64, ::Int64) Closest candidates are: floatrange(::Type{T}, ::Integer, ::Integer, ::Integer, ::Integer) where T at twiceprecision.jl:381 floatrange(::AbstractFloat, ::AbstractFloat, ::Real, ::AbstractFloat) at twiceprecision.jl:395 Stacktrace: [1] floatrange(a::Float64, st::Float64, len::Float64, divisor::Float64) @ Base ./twiceprecision.jl:403 ...

What I have tried: I have tried the following methods but unfortunately none of them works:

  1. Tried to do Pkg.update(), Pkg.resolve(), Pkg.gc()
  2. Tried to first do Pkg.rm("Plots") and then Pkg.add("Plots"). Both commands executed without errors but when I try to import the package again the same error message occurs.
  3. Tried https://juliapackages.com/p/pkgcleanup but it doesn't work.
  4. Tried all methods mentioned in these two links: https://discourse.julialang.org/t/methoderror-no-method-matching-floatrange-when-running-histogram-1-7-0-win-11-21h2-amd-5900hx/72679/6 https://discourse.julialang.org/t/methoderror-no-method-matching-floatrange-when-running-histogram-1-7-0-win-11-21h2-amd-5900hx/72679/6 but unfortunately nothing worked.

The links above did mention something about deleting "old manefest/project files" but unfortunately, as someone who is new to Julia, I have no idea what this means, or how to do that. Any suggestions are greatly appreciated.

Upvotes: 0

Views: 215

Answers (1)

Mark
Mark

Reputation: 12548

Your plots is pretty outdated - the current version is 1.38.11. Do add [email protected] in the Pkg REPL to see what’s holding it back.

On a related note, it is not recommended to install all packages in the default environment. You should keep only development dependencies like IJulia, Revise etc. in the default environment and work in project specific environments with only those packages needed for a specific piece of work to minimise these kinds of version conflicts. (Source)

[Note for future readers: the current version of Plots.jl will most likely change over time. You can find the most recent version here.

Upvotes: 1

Related Questions