julia how to use Plots - julia

When I try and use Plots, It errors. Please help me, how can I deal with it? I am using Julia v1.3.0 and did Pgk.add("Plots") to downloads so I don't know why I have this problem... Is the version of Julia or the Plots package wrong? (I am on macOS, is that the issue?)
using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
ERROR: LoadError: EOFError: read end of file
Stacktrace:
[1] read(::IOStream, ::Type{Int64}) at ./iostream.jl:361
[2] parse_cache_header(::IOStream) at ./loading.jl:1334
[3] stale_cachefile(::String, ::String) at ./loading.jl:1413
[4] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:752
[5] _require(::Base.PkgId) at ./loading.jl:1001
[6] require(::Base.PkgId) at ./loading.jl:922
[7] require(::Module, ::Symbol) at ./loading.jl:917
[8] include at ./boot.jl:328 [inlined]
[9] include_relative(::Module, ::String) at ./loading.jl:1105
[10] include(::Module, ::String) at ./Base.jl:31
[11] top-level scope at none:2
[12] eval at ./boot.jl:330 [inlined]
[13] eval(::Expr) at ./client.jl:425
[14] top-level scope at ./none:3
in expression starting at /Users/owls/.julia/packages/Plots/3INZP/src/Plots.jl:11
ERROR: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to /Users/owls/.julia/compiled/v1.3/Plots/ld3vC_39ter.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1283
[3] _require(::Base.PkgId) at ./loading.jl:1024
[4] require(::Base.PkgId) at ./loading.jl:922
[5] require(::Module, ::Symbol) at ./loading.jl:917

Related

LoadError: InitError: While Precompiling in new Environment

I wanted to start using dedicated environments for all my julia projects, but activating the new environment and using packages (eg. Plots.jl) results in Precompiling that fails with the following error:
Activating environment at `~/Documents/baro/Project.toml`
julia> using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
ERROR: LoadError: InitError: could not load library "/home/marius/.julia/artifacts/08ab4b2de494e1d61e581ab1fbd610b0b4d1876f/lib/libavdevice.so"
libx264.so.157: cannot open shared object file: No such file or directory
Stacktrace:
[1] dlopen(::String, ::UInt32; throw_error::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/Libdl/src/Libdl.jl:109
[2] dlopen at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/Libdl/src/Libdl.jl:109 [inlined] (repeats 2 times)
[3] __init__() at /home/marius/.julia/packages/FFMPEG_jll/tCUYA/src/wrappers/x86_64-linux-gnu.jl:231
[4] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:697
[5] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:781
[6] _require(::Base.PkgId) at ./loading.jl:1006
[7] require(::Base.PkgId) at ./loading.jl:927
[8] require(::Module, ::Symbol) at ./loading.jl:922
[9] include(::Module, ::String) at ./Base.jl:377
[10] top-level scope at none:2
[11] eval at ./boot.jl:331 [inlined]
[12] eval(::Expr) at ./client.jl:449
[13] top-level scope at ./none:3
during initialization of module FFMPEG_jll
in expression starting at /home/marius/.julia/packages/FFMPEG/vocw2/src/FFMPEG.jl:3
ERROR: LoadError: Failed to precompile FFMPEG [c87230d0-a227-11e9-1b43-d7ebe4e7570a] to /home/marius/.julia/compiled/v1.4/FFMPEG/TGvga_eB360.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
[3] _require(::Base.PkgId) at ./loading.jl:1029
[4] require(::Base.PkgId) at ./loading.jl:927
[5] require(::Module, ::Symbol) at ./loading.jl:922
[6] include(::Module, ::String) at ./Base.jl:377
[7] top-level scope at none:2
[8] eval at ./boot.jl:331 [inlined]
[9] eval(::Expr) at ./client.jl:449
[10] top-level scope at ./none:3
in expression starting at /home/marius/.julia/packages/Plots/LWw1t/src/Plots.jl:15
ERROR: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to /home/marius/.julia/compiled/v1.4/Plots/ld3vC_eB360.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
[3] _require(::Base.PkgId) at ./loading.jl:1029
[4] require(::Base.PkgId) at ./loading.jl:927
[5] require(::Module, ::Symbol) at ./loading.jl:922
This also happens for some other packages like ControlSystems.
The julia version is 1.4.2 but I was able to reproduce this error with 1.5.0 and on a different computer with 1.3.1 on it. Both systems are runnning Ubuntu 20.04 LTS.
What I tried so far was:
Rebuilding the package Pkg.build()
Check that the file supposed to load exists (it existed)
Update libx264
Deleting all packages in .julia folder and and reinstalling everything using Pkg.instantiate()
Any help to get the packages running will be greatly appreciated as I really like the idea of having dedicated environments for every project. Also on 1.3.1 even after switching to the default environment the error is still occuring.
The issue seems to lay in the FFMPEG package.
The following solved the issue for me:
Remove FFMPEG. Then delete the folder which is given in the error message. In your case: "/home/marius/.julia/artifacts/08ab4b2de494e1d61e581ab1fbd610b0b4d1876f/lib/libavdevice.so"
Then add FFPEG again which results in a change in the Manifest.toml which does not happen if you just remove FFMPEG:
Updating `~/.julia/environments/v1.3/Manifest.toml`
[1270edf5] ↓ x264_jll v2020.7.14+0 ⇒ v2019.5.25+2
Try: using FFMPEG, Plots.
I was able to precompile Plots then.

Julia Distributions package installation woes

I wish to use the Distributions package in Julia, but can't get to first base. This is what happens when I try adding and using the package:
(v1.1) pkg> add Distributions
Updating registry at `C:\Users\Philip\.julia\registries\General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
Updating `C:\Users\Philip\.julia\environments\v1.1\Project.toml`
[no changes]
Updating `C:\Users\Philip\.julia\environments\v1.1\Manifest.toml`
[no changes]
julia> using Distributions
[ Info: Precompiling Distributions [31c24e10-a181-5473-b8eb-7969acd0382f]
ERROR: LoadError: InitError: C:\Users\Philip\.julia\packages\SpecialFunctions\fvheQ\deps\usr\bin\libopenspecfun.dll cannot be opened, Please re-run Pkg.build("fvheQ"), and restart Julia.
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] check_deps() at C:\Users\Philip\.julia\packages\SpecialFunctions\fvheQ\deps\deps.jl:20
[3] __init__() at C:\Users\Philip\.julia\packages\SpecialFunctions\fvheQ\src\SpecialFunctions.jl:12
[4] _include_from_serialized(::String, ::Array{Any,1}) at .\loading.jl:633
[5] _require_search_from_serialized(::Base.PkgId, ::String) at .\loading.jl:713
[6] _require(::Base.PkgId) at .\loading.jl:937
[7] require(::Base.PkgId) at .\loading.jl:858
[8] require(::Module, ::Symbol) at .\loading.jl:853
[9] include at .\boot.jl:326 [inlined]
[10] include_relative(::Module, ::String) at .\loading.jl:1038
[11] include(::Module, ::String) at .\sysimg.jl:29
[12] top-level scope at none:2
[13] eval at .\boot.jl:328 [inlined]
[14] eval(::Expr) at .\client.jl:404
[15] top-level scope at .\none:3
during initialization of module SpecialFunctions
in expression starting at C:\Users\Philip\.julia\packages\StatsFuns\2QE7p\src\StatsFuns.jl:6
ERROR: LoadError: Failed to precompile StatsFuns [4c63d2b9-4356-54db-8cca-17b64c39e42c] to C:\Users\Philip\.julia\compiled\v1.1\StatsFuns\530lR.ji.
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1197
[3] _require(::Base.PkgId) at .\loading.jl:960
[4] require(::Base.PkgId) at .\loading.jl:858
[5] require(::Module, ::Symbol) at .\loading.jl:853
[6] include at .\boot.jl:326 [inlined]
[7] include_relative(::Module, ::String) at .\loading.jl:1038
[8] include(::Module, ::String) at .\sysimg.jl:29
[9] top-level scope at none:2
[10] eval at .\boot.jl:328 [inlined]
[11] eval(::Expr) at .\client.jl:404
[12] top-level scope at .\none:3
in expression starting at C:\Users\Philip\.julia\packages\Distributions\tfkz4\src\Distributions.jl:3
ERROR: Failed to precompile Distributions [31c24e10-a181-5473-b8eb-7969acd0382f] to C:\Users\Philip\.julia\compiled\v1.1\Distributions\xILW0.ji.
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1197
[3] _require(::Base.PkgId) at .\loading.jl:960
[4] require(::Base.PkgId) at .\loading.jl:858
[5] require(::Module, ::Symbol) at .\loading.jl:853
So something's gone wrong and the first line of the error message asks me to Please re-run Pkg.build("fvheQ"), and restart Julia but I think that syntax is for Julia 0.6, prior to the re-vamped Pkg REPL.
Questions
What's an updated version of the Julia 0.6 command Pkg.build("fvheQ"). I'm using Julia 1.1.1.
So far I've always found adding packages worked smoothly in Julia. If it's not too broad a question, what's a good strategy to resolve package installation problems like this?
That's a bug in the error printing. You actually want to run Pkg.build("SpecialFunctions") , which should redownload the shared library libopenspecfun.

ERROR: LoadError: UndefVarError: TCPServer not defined Julia

the following is the code.
using JEMSS
# println(2+3)
filename = selectXmlFile()
sim = initSim(filename);
simulate!(sim) # run the simulation
printSimStats(sim) # some basic statistics
while I'm running this, I got the following error message:
[ Info: Precompiling JEMSS [24979329-2a3d-50cf-82e3-05af2f1830ac]
┌ Warning: Deprecated syntax `#doc call with ->` at /Users/jack/.julia/packages/HttpServer/ZGldt/src/HttpServer.jl:229.
│ Use `a line break` instead.
└ # ~/.julia/packages/HttpServer/ZGldt/src/HttpServer.jl:229
WARNING: importing deprecated binding Base.listen into HttpServer.
ERROR: LoadError: UndefVarError: TCPServer not defined
Stacktrace:
[1] getproperty(::Module, ::Symbol) at ./sysimg.jl:13
[2] top-level scope at none:0
[3] include at ./boot.jl:317 [inlined]
[4] include_relative(::Module, ::String) at ./loading.jl:1038
[5] include(::Module, ::String) at ./sysimg.jl:29
[6] top-level scope at none:2
[7] eval at ./boot.jl:319 [inlined]
[8] eval(::Expr) at ./client.jl:399
[9] top-level scope at ./none:3
in expression starting at /Users/nanal/.julia/packages/HttpServer/ZGldt/src/HttpServer.jl:31
ERROR: LoadError: Failed to precompile HttpServer [58cfbd8c-6b7d-5447-85c1-563540e28d27] to /Users/jack/.julia/compiled/v0.7/HttpServer/SC4ql.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] macro expansion at ./logging.jl:313 [inlined]
[3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1185
[4] _require(::Base.PkgId) at ./logging.jl:311
[5] require(::Base.PkgId) at ./loading.jl:852
[6] macro expansion at ./logging.jl:311 [inlined]
[7] require(::Module, ::Symbol) at ./loading.jl:834
[8] include at ./boot.jl:317 [inlined]
[9] include_relative(::Module, ::String) at ./loading.jl:1038
[10] include(::Module, ::String) at ./sysimg.jl:29
[11] top-level scope at none:2
[12] eval at ./boot.jl:319 [inlined]
[13] eval(::Expr) at ./client.jl:399
[14] top-level scope at ./none:3
in expression starting at /Users/jack/.julia/dev/JEMSS/src/JEMSS.jl:20
I was trying to search to find out what exactly is this "ERROR: LoadError: UndefVarError: TCPServer not defined", but I can not find any. Can anyone please tell me where I can find any references for it? Many thanks!

Unable to install IJulia failed to clone from repository error

I tried
julia> using Pkg
julia> Pkg.add("IJulia")
And everytime I am getting the same error
Cloning default registries into C:\Users\Himanshu Poddar\.julia\registries
Cloning registry General from "https://github.com/JuliaRegistries/General.git"
ERROR: failed to clone from https://github.com/JuliaRegistries/General.git, error: GitError(Code:ERROR, Class:OS, failed to send request: The connection with the server was terminated abnormally
)
Stacktrace:
[1] pkgerror(::String) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Pkg\src\Types.jl:120
[2] #clone#2(::String, ::Base.Iterators.Pairs{Symbol,LibGit2.CachedCredentials,Tuple{Symbol},NamedTuple{(:credentials,),Tuple{LibGit2.CachedCredentials}}}, ::Function, ::String, ::String) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Pkg\src\GitTools.jl:107
[3] #clone at .\none:0 [inlined]
[4] (::getfield(Pkg.Types, Symbol("##51#55")))(::LibGit2.CachedCredentials) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Pkg\src\Types.jl:933
[5] shred!(::getfield(Pkg.Types, Symbol("##51#55")), ::LibGit2.CachedCredentials) at .\secretbuffer.jl:184
[6] #registries#50(::Bool, ::Function) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Pkg\src\Types.jl:929
[7] registries at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Pkg\src\Types.jl:913 [inlined]
[8] macro expansion at .\logging.jl:307 [inlined]
[9] update_registry(::Pkg.Types.Context) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Pkg\src\API.jl:97
[10] #handle_repos_add!#32(::Bool, ::Nothing, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Pkg\src\Types.jl:607
[11] #handle_repos_add! at .\none:0 [inlined]
[12] #add_or_develop#13(::Symbol, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Pkg\src\API.jl:54
[13] #add_or_develop at .\none:0 [inlined]
[14] #add_or_develop#12 at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Pkg\src\API.jl:29 [inlined]
[15] #add_or_develop at .\none:0 [inlined]
[16] #add_or_develop#11 at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Pkg\src\API.jl:28 [inlined]
[17] #add_or_develop at .\none:0 [inlined]
[18] #add_or_develop#10 at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Pkg\src\API.jl:27 [inlined]
[19] #add_or_develop at .\none:0 [inlined]
[20] #add#18 at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Pkg\src\API.jl:69 [inlined]
[21] add(::String) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Pkg\src\API.jl:69
[22] top-level scope at none:0
How can I resolve this issue?
The problem was I guess a firewall issue. I was working on my institution wifi. And then I changed it to my personal hotspot and tried installing it again and it worked.

julia JuMP with v0.7

I tried building JuMP after compiling v0.7 but am getting errors:
ERROR: LoadError: Failed to precompile ReverseDiffSparse to /Users/MYUSER/.julia/lib/v0.7/ReverseDiffSparse.ji.
Stacktrace:
[1] error at ./error.jl:33 [inlined]
[2] compilecache(::Base.PkgId) at ./loading.jl:1208
[3] _require(::Base.PkgId) at ./loading.jl:974
[4] require(::Module, ::Symbol) at ./loading.jl:874
[5] include at ./boot.jl:295 [inlined]
[6] include_relative(::Module, ::String) at ./loading.jl:1067
[7] include(::Module, ::String) at ./sysimg.jl:26
[8] top-level scope
[9] eval at ./boot.jl:298 [inlined]
[10] top-level scope at ./<missing>:3
in expression starting at /Users/MYUSER/.julia/v0.7/JuMP/src/JuMP.jl:21
ERROR: Failed to precompile JuMP to /Users/MYUSER/.julia/lib/v0.7/JuMP.ji.
Stacktrace:
[1] error at ./error.jl:33 [inlined]
[2] compilecache(::Base.PkgId) at ./loading.jl:1208
[3] _require(::Base.PkgId) at ./loading.jl:1003
[4] require(::Module, ::Symbol) at ./loading.jl:874
How do I interpret these / how can I build JuMP for the latest version 0.7?
If you look at the original error message you'll probably see that StaticArrays (one of JuMP's indirect dependencies) does not load on 0.7. Anyway Julia 0.7 is in a pre-alpha state; there are no tagged prereleases of it yet as of today. It has lots of cool features, but I'd only recommend using it at this point if you're comfortable fixing broken packages and deprecation warnings.

Resources