Cannot install JuliaSymbolics / SymbolicUtils.jl - julia

I'm using Ubuntu 20.04.3 LTS (GNU/Linux 5.4.0-100-generic x86_64), julia v1.7.
] add SymbolicUtils failed to install this package.
The output of Pkg.precompile() is:
Precompiling project...
✗ Groebner
✗ Symbolics
0 dependencies successfully precompiled in 8 seconds (327 already precompiled)
ERROR: The following 2 direct dependencies failed to precompile:
SymbolicUtils [d1185830-fcd6-423d-90d6-eec64667417b]
Error: Missing source file for SymbolicUtils [d1185830-fcd6-423d-90d6-eec64667417b]
Symbolics [0c5d862f-8b57-4792-8d23-62f2024744c7]
Failed to precompile Symbolics [0c5d862f-8b57-4792-8d23-62f2024744c7] to ~/.julia/compiled/v1.7/Symbolics/jl_VPYpQf.
ERROR: LoadError: ArgumentError: Package SymbolicUtils [d1185830-fcd6-423d-90d6-eec64667417b] is required but does not seem to be installed:
- Run `Pkg.instantiate()` to install all recorded dependencies.
Stacktrace:
[1] _require(pkg::Base.PkgId)
# Base ./loading.jl:1089
[2] require(uuidkey::Base.PkgId)
# Base ./loading.jl:1013
[3] require(into::Module, mod::Symbol)
# Base ./loading.jl:997
[4] include
# ./Base.jl:418 [inlined]
[5] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
# Base ./loading.jl:1318
[6] top-level scope
# none:1
[7] eval
# ./boot.jl:373 [inlined]
[8] eval(x::Expr)
# Base.MainInclude ./client.jl:453
[9] top-level scope
# none:1
in expression starting at ~/.julia/packages/Symbolics/kG5bl/src/Symbolics.jl:1
Stacktrace:
[1] pkgerror(msg::String)
# Pkg.Types ~/software/julia-1.7.3/share/julia/stdlib/v1.7/Pkg/src/Types.jl:68
[2] precompile(ctx::Pkg.Types.Context; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
# Pkg.API ~/software/julia-1.7.3/share/julia/stdlib/v1.7/Pkg/src/API.jl:1362
[3] precompile
# ~/software/julia-1.7.3/share/julia/stdlib/v1.7/Pkg/src/API.jl:1013 [inlined]
[4] #precompile#220
# ~/software/julia-1.7.3/share/julia/stdlib/v1.7/Pkg/src/API.jl:1011 [inlined]
[5] precompile()
# Pkg.API ~/software/julia-1.7.3/share/julia/stdlib/v1.7/Pkg/src/API.jl:1011
[6] top-level scope
# REPL[1]:1
Why can't I install it? I'm happy to provide more info if needed.
If I remove them by Pkg.rm("SymbolicUtils"); Pkg.rm("Symbolics"), Pkg.precomile() does work. Then ] add SymbolicUtils yields:
Resolving package versions...2.3
Updating `~/.julia/environments/v1.7/Project.toml`
[d1185830] + SymbolicUtils v0.19.11
Updating `~/.julia/environments/v1.7/Manifest.toml`
[1520ce14] + AbstractTrees v0.4.2
[dce04be8] + ArgCheck v2.3.0
[15f4f7f2] + AutoHashEquals v0.2.0
[198e06fe] + BangBang v0.3.36
[9718e550] + Baselet v0.1.1
[e2ed5e7c] + Bijections v0.1.4
[861a8166] + Combinatorics v1.0.2
[a33af91c] + CompositionsBase v0.1.1
[244e2a9f] + DefineSingletons v0.1.2
[7c1d4256] + DynamicPolynomials v0.4.5
[22cec73e] + InitialValues v0.3.1
[2ee39098] + LabelledArrays v1.11.1
[e9d8d322] + Metatheory v1.3.4
[128add7d] + MicroCollections v0.1.2
[102ac46a] + MultivariatePolynomials v0.4.6
[42d2dcc6] + Referenceables v0.1.2
[171d559e] + SplittablesBase v0.1.14
[d1185830] + SymbolicUtils v0.19.11
[8ea1fca8] + TermInterface v0.2.3
[ac1d9e8a] + ThreadsX v0.1.10
[28d57a85] + Transducers v0.4.73
0 dependencies successfully precompiled in 2 seconds (319 already precompiled)
1 dependency errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the package
precompile yields:
ERROR: The following 1 direct dependency failed to precompile:
SymbolicUtils [d1185830-fcd6-423d-90d6-eec64667417b]
Error: Missing source file for SymbolicUtils [d1185830-fcd6-423d-90d6-eec64667417b```

Related

Installing Flux.jl on Linux: NNlibCUDA fails to precompile

While trying to install Flux I run into an error where it fails to precompile the NNlibCUDA library.
Running ] test NNlibCUDA results in LoadError: UndefVarError: upsample_linear_wcn! not defined:
(#v1.7) pkg> test NNlibCUDA
Testing NNlibCUDA
Status `/tmp/jl_1psy2E/Project.toml`
[052768ef] CUDA v3.10.1
[f6369f11] ForwardDiff v0.10.30
[872c559c] NNlib v0.8.6
[a00861dc] NNlibCUDA v0.2.3
[e88e6eb3] Zygote v0.6.40
[37e2e46d] LinearAlgebra `#stdlib/LinearAlgebra`
[9a3f8284] Random `#stdlib/Random`
[10745b16] Statistics `#stdlib/Statistics`
[8dfed614] Test `#stdlib/Test`
Status `/tmp/jl_1psy2E/Manifest.toml`
[621f4979] AbstractFFTs v1.1.0
[79e6a3ab] Adapt v3.3.3
[ab4f0b2a] BFloat16s v0.2.0
[fa961155] CEnum v0.4.2
[052768ef] CUDA v3.10.1
[082447d4] ChainRules v1.35.1
[d360d2e6] ChainRulesCore v1.15.0
[9e997f8a] ChangesOfVariables v0.1.3
[bbf7d656] CommonSubexpressions v0.3.0
[34da2185] Compat v3.44.0
[163ba53b] DiffResults v1.0.3
[b552c78f] DiffRules v1.11.0
[ffbed154] DocStringExtensions v0.8.6
[e2ba6199] ExprTools v0.1.8
[1a297f60] FillArrays v0.13.2
[f6369f11] ForwardDiff v0.10.30
[0c68f7d7] GPUArrays v8.3.2
[61eb1bfa] GPUCompiler v0.15.2
[7869d1d1] IRTools v0.4.6
[3587e190] InverseFunctions v0.1.4
[92d709cd] IrrationalConstants v0.1.1
[692b3bcd] JLLWrappers v1.4.1
[929cbde3] LLVM v4.13.0
[2ab3a3ac] LogExpFunctions v0.3.15
[1914dd2f] MacroTools v0.5.9
[872c559c] NNlib v0.8.6
[a00861dc] NNlibCUDA v0.2.3
[77ba4419] NaNMath v1.0.0
[21216c6a] Preferences v1.3.0
[74087812] Random123 v1.5.0
[e6cf234a] RandomNumbers v1.5.3
[c1ae055f] RealDot v0.1.0
[189a3867] Reexport v1.2.2
[ae029012] Requires v1.3.0
[276daf66] SpecialFunctions v2.1.5
[90137ffa] StaticArrays v1.4.4
[a759f4b9] TimerOutputs v0.5.19
[e88e6eb3] Zygote v0.6.40
[700de1a5] ZygoteRules v0.2.2
[dad2f222] LLVMExtra_jll v0.0.16+0
[efe28fd5] OpenSpecFun_jll v0.5.5+0
[0dad84c5] ArgTools `#stdlib/ArgTools`
[56f22d72] Artifacts `#stdlib/Artifacts`
[2a0f44e3] Base64 `#stdlib/Base64`
[ade2ca70] Dates `#stdlib/Dates`
[8bb1440f] DelimitedFiles `#stdlib/DelimitedFiles`
[8ba89e20] Distributed `#stdlib/Distributed`
[f43a241f] Downloads `#stdlib/Downloads`
[7b1f6079] FileWatching `#stdlib/FileWatching`
[b77e0a4c] InteractiveUtils `#stdlib/InteractiveUtils`
[4af54fe1] LazyArtifacts `#stdlib/LazyArtifacts`
[b27032c2] LibCURL `#stdlib/LibCURL`
[76f85450] LibGit2 `#stdlib/LibGit2`
[8f399da3] Libdl `#stdlib/Libdl`
[37e2e46d] LinearAlgebra `#stdlib/LinearAlgebra`
[56ddb016] Logging `#stdlib/Logging`
[d6f4376e] Markdown `#stdlib/Markdown`
[a63ad114] Mmap `#stdlib/Mmap`
[ca575930] NetworkOptions `#stdlib/NetworkOptions`
[44cfe95a] Pkg `#stdlib/Pkg`
[de0858da] Printf `#stdlib/Printf`
[3fa0cd96] REPL `#stdlib/REPL`
[9a3f8284] Random `#stdlib/Random`
[ea8e919c] SHA `#stdlib/SHA`
[9e88b42a] Serialization `#stdlib/Serialization`
[1a1011a3] SharedArrays `#stdlib/SharedArrays`
[6462fe0b] Sockets `#stdlib/Sockets`
[2f01184e] SparseArrays `#stdlib/SparseArrays`
[10745b16] Statistics `#stdlib/Statistics`
[fa267f1f] TOML `#stdlib/TOML`
[a4e569a6] Tar `#stdlib/Tar`
[8dfed614] Test `#stdlib/Test`
[cf7118a7] UUIDs `#stdlib/UUIDs`
[4ec0a83e] Unicode `#stdlib/Unicode`
[e66e0078] CompilerSupportLibraries_jll `#stdlib/CompilerSupportLibraries_jll`
[deac9b47] LibCURL_jll `#stdlib/LibCURL_jll`
[29816b5a] LibSSH2_jll `#stdlib/LibSSH2_jll`
[c8ffd9c3] MbedTLS_jll `#stdlib/MbedTLS_jll`
[14a3606d] MozillaCACerts_jll `#stdlib/MozillaCACerts_jll`
[4536629a] OpenBLAS_jll `#stdlib/OpenBLAS_jll`
[05823500] OpenLibm_jll `#stdlib/OpenLibm_jll`
[83775a58] Zlib_jll `#stdlib/Zlib_jll`
[8e850b90] libblastrampoline_jll `#stdlib/libblastrampoline_jll`
[8e850ede] nghttp2_jll `#stdlib/nghttp2_jll`
[3f19e933] p7zip_jll `#stdlib/p7zip_jll`
Precompiling project...
✗ NNlibCUDA
0 dependencies successfully precompiled in 4 seconds (47 already precompiled)
1 dependency errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the package
Testing Running tests...
ERROR: LoadError: UndefVarError: upsample_linear_wcn! not defined
Stacktrace:
[1] getproperty(x::Module, f::Symbol)
# Base ./Base.jl:35
[2] top-level scope
# ~/.julia/packages/NNlibCUDA/vECff/src/upsample.jl:118
[3] include(mod::Module, _path::String)
# Base ./Base.jl:418
[4] include(x::String)
# NNlibCUDA ~/.julia/packages/NNlibCUDA/vECff/src/NNlibCUDA.jl:1
[5] top-level scope
# ~/.julia/packages/NNlibCUDA/vECff/src/NNlibCUDA.jl:9
[6] include
# ./Base.jl:418 [inlined]
[7] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
# Base ./loading.jl:1318
[8] top-level scope
# none:1
[9] eval
# ./boot.jl:373 [inlined]
[10] eval(x::Expr)
# Base.MainInclude ./client.jl:453
[11] top-level scope
# none:1
in expression starting at /home/manman/.julia/packages/NNlibCUDA/vECff/src/upsample.jl:118
in expression starting at /home/manman/.julia/packages/NNlibCUDA/vECff/src/NNlibCUDA.jl:1
ERROR: LoadError: Failed to precompile NNlibCUDA [a00861dc-f156-4864-bf3c-e6376f28a68d] to /home/manman/.julia/compiled/v1.7/NNlibCUDA/jl_kwzmLD.
Stacktrace:
[1] error(s::String)
# Base ./error.jl:33
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
# Base ./loading.jl:1466
[3] compilecache(pkg::Base.PkgId, path::String)
# Base ./loading.jl:1410
[4] _require(pkg::Base.PkgId)
# Base ./loading.jl:1120
[5] require(uuidkey::Base.PkgId)
# Base ./loading.jl:1013
[6] require(into::Module, mod::Symbol)
# Base ./loading.jl:997
[7] include(fname::String)
# Base.MainInclude ./client.jl:451
[8] top-level scope
# none:6
in expression starting at /home/manman/.julia/packages/NNlibCUDA/vECff/test/runtests.jl:4
ERROR: Package NNlibCUDA errored during testing
I am running Julia 1.7.3 on Pop!_OS 22.04 with a GTX 1050Ti Mobile.
I just had this issue. I found that running ] update fixed it.

Julia Roots find_zero with ForwardDiff.Dual type?

I'm trying to apply automatic differentiation (ForwardDiff) to a function that contains an instance of find_zero (Roots) and am encountering an error that seems to relate to find_zero not accepting the ForwardDiff.Dual type.
Here's a (contrived) minimal working example that illustrates the issue:
using Distributions
using Roots
using StatsFuns
using ForwardDiff
function test_fun(θ::AbstractVector{T}) where T
μ,σ,p = θ;
z_star = find_zero(z -> logistic(z) - p, 0.0)
return pdf(Normal(μ,σ),z_star)
end
test_fun([0.0,1.0,0.75])
ForwardDiff.gradient(test_fun,[0.0,1.0,0.75])
This results in the following error:
ERROR: MethodError: no method matching Float64(::ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3})
Closest candidates are:
Float64(::Real, ::RoundingMode) where T<:AbstractFloat at rounding.jl:200
Float64(::T) where T<:Number at boot.jl:716
Float64(::Irrational{:invsqrt2}) at irrationals.jl:189
...
Stacktrace:
[1] convert(::Type{Float64}, ::ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}) at ./number.jl:7
[2] setproperty!(::Roots.UnivariateZeroState{Float64,ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}}, ::Symbol, ::ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}) at ./Base.jl:34
[3] update_state(::Roots.Secant, ::Roots.DerivativeFree{Roots.DerivativeFree{var"#5#6"{ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}}}}, ::Roots.UnivariateZeroState{Float64,ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}}, ::Roots.UnivariateZeroOptions{Float64,Float64,ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3},ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}}) at /bbkinghome/asharris/.julia/packages/Roots/TZpjF/src/derivative_free.jl:163
[4] find_zero(::Roots.Secant, ::Roots.AlefeldPotraShi, ::Roots.DerivativeFree{Roots.DerivativeFree{var"#5#6"{ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}}}}, ::Roots.UnivariateZeroState{Float64,ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}}, ::Roots.UnivariateZeroOptions{Float64,Float64,ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3},ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}}, ::Roots.NullTracks) at /bbkinghome/asharris/.julia/packages/Roots/TZpjF/src/find_zero.jl:868
[5] find_zero(::Roots.DerivativeFree{var"#5#6"{ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}}}, ::Float64, ::Roots.Secant, ::Roots.AlefeldPotraShi; tracks::Roots.NullTracks, verbose::Bool, p::Nothing, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /bbkinghome/asharris/.julia/packages/Roots/TZpjF/src/find_zero.jl:689
[6] #find_zero#36 at /bbkinghome/asharris/.julia/packages/Roots/TZpjF/src/derivative_free.jl:123 [inlined]
[7] find_zero at /bbkinghome/asharris/.julia/packages/Roots/TZpjF/src/derivative_free.jl:120 [inlined]
[8] #find_zero#5 at /bbkinghome/asharris/.julia/packages/Roots/TZpjF/src/find_zero.jl:707 [inlined]
[9] find_zero at /bbkinghome/asharris/.julia/packages/Roots/TZpjF/src/find_zero.jl:707 [inlined]
[10] test_fun at ./REPL[7856]:3 [inlined]
[11] vector_mode_dual_eval at /bbkinghome/asharris/.julia/packages/ForwardDiff/QOqCN/src/apiutils.jl:37 [inlined]
[12] vector_mode_gradient(::typeof(test_fun), ::Array{Float64,1}, ::ForwardDiff.GradientConfig{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3,Array{ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3},1}}) at /bbkinghome/asharris/.julia/packages/ForwardDiff/QOqCN/src/gradient.jl:106
[13] gradient(::Function, ::Array{Float64,1}, ::ForwardDiff.GradientConfig{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3,Array{ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3},1}}, ::Val{true}) at /bbkinghome/asharris/.julia/packages/ForwardDiff/QOqCN/src/gradient.jl:19
[14] gradient(::Function, ::Array{Float64,1}, ::ForwardDiff.GradientConfig{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3,Array{ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3},1}}) at /bbkinghome/asharris/.julia/packages/ForwardDiff/QOqCN/src/gradient.jl:17 (repeats 2 times)
[15] top-level scope at REPL[7858]:1
[16] run_repl(::REPL.AbstractREPL, ::Any) at /builddir/build/BUILD/julia/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288
I have limited experience using the FowardDiff package and am probably misunderstanding how the Dual type works, so I would really appreciate if someone knows how to solve this issue. Thanks so much!
z_star = find_zero(z -> logistic(z) - p, 0.0)
You have a fixed initial condition which is non-dual. Make it dual.
z_star = find_zero(z -> logistic(z) - p, zero(eltype(θ))

understanding JuMP in Julia Lang?

using JuMP, Clp
d = [40 60 75 25] # monthly demand for boats
m = Model(with_optimizer(Clp.Optimizer))
#variables(m, begin
0 <= x[1:4] <= 40 #boats produced with regular labor
y[1:4]>= 0 #boats produced with overtime labor
h[1:5] >= 0 #boats held in inventory
end)
#constraint(m, h[1] == 10)
#constraint(m, flow[i in 1:4], h[i]+x[i]+y[i]==d[i]+h[i+1]) # conservation of boats
#objective(m, Min, 400*sum(x) + 450*sum(y) + 20*sum(h)) # minimize costs
status = optimize!(m)
println("Build ", Array{Int64}(value(x')), " using regular labor")
println("Build ", Array{Int64}(value(x')), " using regular labor")
println("Build ", Array{Int64}(value(y')), " using overtime labor")
println("Inventory: ", Array{Int64}(value(h'))
I am very new to Julia Language. I am practicing with the code above. But I am getting an error which I don't seem to understand. The error is:
ERROR: LoadError: `JuMP.value` is not defined for collections of JuMP types. Use Julia's broadcast syntax instead: `JuMP.value.(x)`.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] value(::LinearAlgebra.Adjoint{VariableRef,Array{VariableRef,1}}) at /Users/pst/.julia/packages/JuMP/MsUSY/src/variables.jl:832
[3] top-level scope at none:0
[4] include at ./boot.jl:317 [inlined]
[5] include_relative(::Module, ::String) at ./loading.jl:1044
[6] include(::Module, ::String) at ./sysimg.jl:29
[7] exec_options(::Base.JLOptions) at ./client.jl:266
[8] _start() at ./client.jl:425
in expression starting at /Users/pst/Optimization/sailcovar1.jl:22.
Please help me out. Thanks
In order to apply a scalar function (like Jump.value) to a vector or array, you need to use the dot notation for broadcasting. So you need to replace all of your value(...) calls with value.(...).

LoadError:PyCall.PyError ("\$(Expr(:escape, :(ccall(#= /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:44 =# #pysym(:PyObject_Call)

I am getting the following Error for PyCall and am on Julia v 1.2.0
ERROR: LoadError: PyCall.PyError("\$(Expr(:escape, :(ccall(#= /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:44 =# #pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))", PyCall.PyObject(Ptr{PyCall.PyObject_struct} #0x00007f9ea56a2520), PyCall.PyObject(Ptr{PyCall.PyObject_struct} #0x00007f9db65dcca8), PyCall.PyObject(Ptr{PyCall.PyObject_struct} #0x00007f9d004f9f08))
Stacktrace:
[1] pyerr_check at /home/omkar/.julia/packages/PyCall/ttONZ/src/exception.jl:60 [inlined]
[2] pyerr_check at /home/omkar/.julia/packages/PyCall/ttONZ/src/exception.jl:64 [inlined]
[3] macro expansion at /home/omkar/.julia/packages/PyCall/ttONZ/src/exception.jl:84 [inlined]
[4] __pycall!(::PyCall.PyObject, ::Ptr{PyCall.PyObject_struct}, ::PyCall.PyObject, ::Ptr{Nothing}) at /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:44
[5] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{String,String,String,String,String,Float64,String,Float64}, ::Int64, ::Ptr{Nothing}) at /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:29
[6] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{String,String,String,String,String,Float64,String,Float64}, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:11
[7] #call#111(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::PyCall.PyObject, ::String, ::Vararg{Any,N} where N) at /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:89
[8] (::PyCall.PyObject)(::String, ::Vararg{Any,N} where N) at /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:89
I have already tried update and below is the setup for the build file
ENV["PYTHON"] = " "
Pkg.build("PyCall")
using PyCall, Conda
pyexec = pyimport("sys").executable

No method matching ^

I created a UnitRange in Julia and trying to create a plot of x with respect to x and x ^ 2. I have written the following code.
x = [-10:10]
p1 = plot(x, x)
p2 = plot(x, x.^2)
I am getting the following error:
MethodError: no method matching ^(::UnitRange{Int64}, ::Int64)
Closest candidates are:
^(!Matched::Float16, ::Integer) at math.jl:795
^(!Matched::Missing, ::Integer) at missing.jl:120
^(!Matched::Missing, ::Number) at missing.jl:93
...
Stacktrace:
[1] _broadcast_getindex at ./none:0 [inlined]
[2] getindex at ./broadcast.jl:515 [inlined]
[3] copy at ./broadcast.jl:790 [inlined]
[4] materialize(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(Base.literal_pow),Tuple{Base.RefValue{typeof(^)},Array{UnitRange{Int64},1},Base.RefValue{Val{2}}}}) at ./broadcast.jl:756
[5] top-level scope at In[18]:3
What is the mistake in my code?
You can change:
x.^2
to:
x[1].^2

Resources