Quantum Simulation in Julia

I am facing Problem in Simulation can anyone help me to solve a small problem

If you browse through the topics here you’ll see that people in general are very happy to help, however you do need to give them a fighting chance - I would recommend you read

And edit your question accordingly.

3 Likes

I face problem with Plots Pakage, I tried alot but its not working, it gives me an error

Hi,

It might help to provide more details about your error message, environment and OS. Can you paste the entire error message as formatted text. Same for your environment by typing ] st. In some cases, it helps to indicate which OS you are using.

Actually my main Problem is I can’t use the Plots, it gives me Error and a very long message. If Possible we can zoom and I may share my screen?

No, if you share error messages, please copy and paste them and enclose them in triple backticks, like ```

Furthermore, please share the output of

using Pkg
Pkg.status()

Finally, the error you posted as screenshot is just a warning, you can ignore it.

One thing I see here is that you are using PyPlots and Plots together. One option - if Plots is not working for you - would be to use only PyPlot, if that works it allows to create nice plots already on its own…

The access denied error looks like Permissions issues with artifacts on Windows in 1.10-rc1 (and betas) - Access is denied · Issue #52272 · JuliaLang/julia · GitHub .

If you really hit this bug, the workaround is to use Julia 1.9 …

But again: Please do NOT share screenshots, copy and paste the text of the error message instead, much easier to read… And it also works for error messages that do not fit on one screen.

For using PyPlot
I get the Error
Precompiling PyPlot
âś— PyCall
Info Given PyPlot was explicitly requested, output will be shown live
ERROR: LoadError: PyCall not properly installed. Please run Pkg.build(“PyCall”)
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:35
[2] top-level scope
@ C:\Users\KRY.julia\packages\PyCall\JVcVh\src\startup.jl:44
[3] include(mod::Module, _path::String)
@ Base .\Base.jl:495
[4] include(x::String)
@ PyCall C:\Users\KRY.julia\packages\PyCall\JVcVh\src\PyCall.jl:1
[5] top-level scope
@ C:\Users\KRY.julia\packages\PyCall\JVcVh\src\PyCall.jl:38
[6] include
@ Base .\Base.jl:495 [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, UInt128}}, source::String)
@ Base .\loading.jl:2216
[8] top-level scope
@ stdin:3
in expression starting at C:\Users\KRY.julia\packages\PyCall\JVcVh\src\startup.jl:41
in expression starting at C:\Users\KRY.julia\packages\PyCall\JVcVh\src\PyCall.jl:1
in expression starting at stdin:3
ERROR: LoadError: Failed to precompile PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45ab0] to “C:\Users\KRY\.julia\compiled\v1.10\PyCall\jl_D22A.tmp”.
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
@ Base .\loading.jl:2462
[3] compilecache
@ Base .\loading.jl:2334 [inlined]
[4] (::Base.var"#968#969"{Base.PkgId})()
@ Base .\loading.jl:1968
[5] mkpidlock(f::Base.var"#968#969"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale_age::Int64, wait::Bool})
@ FileWatching.Pidfile C:\Users\KRY\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:93
[6] #mkpidlock#6
@ FileWatching.Pidfile C:\Users\KRY\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:88 [inlined]
[7] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale_age::Int64})
@ FileWatching.Pidfile C:\Users\KRY\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:111
[8] #invokelatest#2
@ Base .\essentials.jl:889 [inlined]
[9] invokelatest
@ Base .\essentials.jl:884 [inlined]
[10] maybe_cachefile_lock(f::Base.var"#968#969"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale_age::Int64)
@ Base .\loading.jl:2977
[11] maybe_cachefile_lock
@ Base .\loading.jl:2974 [inlined]
[12] _require(pkg::Base.PkgId, env::String)
@ Base .\loading.jl:1964
[13] __require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base .\loading.jl:1806
[14] #invoke_in_world#3
@ Base .\essentials.jl:921 [inlined]
[15] invoke_in_world
@ Base .\essentials.jl:918 [inlined]
[16] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base .\loading.jl:1797
[17] macro expansion
@ Base .\loading.jl:1784 [inlined]
[18] macro expansion
@ Base .\lock.jl:267 [inlined]
[19] __require(into::Module, mod::Symbol)
@ Base .\loading.jl:1747
[20] #invoke_in_world#3
@ Base .\essentials.jl:921 [inlined]
[21] invoke_in_world
@ Base .\essentials.jl:918 [inlined]
[22] require(into::Module, mod::Symbol)
@ Base .\loading.jl:1740
[23] include
@ Base .\Base.jl:495 [inlined]
[24] 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, UInt128}}, source::Nothing)
@ Base .\loading.jl:2216
[25] top-level scope
@ stdin:3
in expression starting at C:\Users\KRY.julia\packages\PyPlot\2MlrT\src\PyPlot.jl:2
in expression starting at stdin:3
âś— PyPlot
0 dependencies successfully precompiled in 6 seconds. 16 already precompiled.

The following 2 direct dependencies failed to precompile:

PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45ab0]

Failed to precompile PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45ab0] to “C:\Users\KRY\.julia\compiled\v1.10\PyCall\jl_CA3A.tmp”.
ERROR: LoadError: PyCall not properly installed. Please run Pkg.build(“PyCall”)
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:35
[2] top-level scope
@ C:\Users\KRY.julia\packages\PyCall\JVcVh\src\startup.jl:44
[3] include(mod::Module, _path::String)
@ Base .\Base.jl:495
[4] include(x::String)
@ PyCall C:\Users\KRY.julia\packages\PyCall\JVcVh\src\PyCall.jl:1
[5] top-level scope
@ C:\Users\KRY.julia\packages\PyCall\JVcVh\src\PyCall.jl:38
[6] include
@ Base .\Base.jl:495 [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, UInt128}}, source::Nothing)
@ Base .\loading.jl:2216
[8] top-level scope
@ stdin:3
in expression starting at C:\Users\KRY.julia\packages\PyCall\JVcVh\src\startup.jl:41
in expression starting at C:\Users\KRY.julia\packages\PyCall\JVcVh\src\PyCall.jl:1
in expression starting at stdin:3
PyPlot [d330b81b-6aea-500a-939a-2ce795aea3ee]

Failed to precompile PyPlot [d330b81b-6aea-500a-939a-2ce795aea3ee] to “C:\Users\KRY\.julia\compiled\v1.10\PyPlot\jl_D152.tmp”.
ERROR: LoadError: PyCall not properly installed. Please run Pkg.build(“PyCall”)
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:35
[2] top-level scope
@ C:\Users\KRY.julia\packages\PyCall\JVcVh\src\startup.jl:44
[3] include(mod::Module, _path::String)
@ Base .\Base.jl:495
[4] include(x::String)
@ PyCall C:\Users\KRY.julia\packages\PyCall\JVcVh\src\PyCall.jl:1
[5] top-level scope
@ C:\Users\KRY.julia\packages\PyCall\JVcVh\src\PyCall.jl:38
[6] include
@ Base .\Base.jl:495 [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, UInt128}}, source::String)
@ Base .\loading.jl:2216
[8] top-level scope
@ stdin:3
in expression starting at C:\Users\KRY.julia\packages\PyCall\JVcVh\src\startup.jl:41
in expression starting at C:\Users\KRY.julia\packages\PyCall\JVcVh\src\PyCall.jl:1
in expression starting at stdin:3
ERROR: LoadError: Failed to precompile PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45ab0] to “C:\Users\KRY\.julia\compiled\v1.10\PyCall\jl_D22A.tmp”.
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
@ Base .\loading.jl:2462
[3] compilecache
@ Base .\loading.jl:2334 [inlined]
[4] (::Base.var"#968#969"{Base.PkgId})()
@ Base .\loading.jl:1968
[5] mkpidlock(f::Base.var"#968#969"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale_age::Int64, wait::Bool})
@ FileWatching.Pidfile C:\Users\KRY\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:93
[6] #mkpidlock#6
@ FileWatching.Pidfile C:\Users\KRY\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:88 [inlined]
[7] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale_age::Int64})
@ FileWatching.Pidfile C:\Users\KRY\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:111
[8] #invokelatest#2
@ Base .\essentials.jl:889 [inlined]
[9] invokelatest
@ Base .\essentials.jl:884 [inlined]
[10] maybe_cachefile_lock(f::Base.var"#968#969"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale_age::Int64)
@ Base .\loading.jl:2977
[11] maybe_cachefile_lock
@ Base .\loading.jl:2974 [inlined]
[12] _require(pkg::Base.PkgId, env::String)
@ Base .\loading.jl:1964
[13] __require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base .\loading.jl:1806
[14] #invoke_in_world#3
@ Base .\essentials.jl:921 [inlined]
[15] invoke_in_world
@ Base .\essentials.jl:918 [inlined]
[16] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base .\loading.jl:1797
[17] macro expansion
@ Base .\loading.jl:1784 [inlined]
[18] macro expansion
@ Base .\lock.jl:267 [inlined]
[19] __require(into::Module, mod::Symbol)
@ Base .\loading.jl:1747
[20] #invoke_in_world#3
@ Base .\essentials.jl:921 [inlined]
[21] invoke_in_world
@ Base .\essentials.jl:918 [inlined]
[22] require(into::Module, mod::Symbol)
@ Base .\loading.jl:1740
[23] include
@ Base .\Base.jl:495 [inlined]
[24] 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, UInt128}}, source::Nothing)
@ Base .\loading.jl:2216
[25] top-level scope
@ stdin:3
in expression starting at C:\Users\KRY.julia\packages\PyPlot\2MlrT\src\PyPlot.jl:2
in expression starting at stdin:3

Stacktrace:
[1] pkgerror(msg::String)
@ Pkg.Types C:\Users\KRY\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\Pkg\src\Types.jl:70
[2] precompile(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, timing::Bool, _from_loading::Bool, kwargs::@Kwargs{io::IJulia.IJuliaStdio{Base.PipeEndpoint}})
@ Pkg.API C:\Users\KRY\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\Pkg\src\API.jl:1656
[3] precompile(pkgs::Vector{Pkg.Types.PackageSpec}; io::IJulia.IJuliaStdio{Base.PipeEndpoint}, kwargs::@Kwargs{_from_loading::Bool})
@ Pkg.API C:\Users\KRY\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\Pkg\src\API.jl:159
[4] precompile
@ Pkg.API C:\Users\KRY\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\Pkg\src\API.jl:147 [inlined]
[5] precompile#114
@ Pkg.API C:\Users\KRY\AppData\Local\Programs\Julia-1.10.0\share\julia\stdlib\v1.10\Pkg\src\API.jl:146 [inlined]
[6] #invokelatest#2
@ Base .\essentials.jl:889 [inlined]
[7] invokelatest
@ Base .\essentials.jl:884 [inlined]
[8] _require(pkg::Base.PkgId, env::String)
@ Base .\loading.jl:1957
[9] __require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base .\loading.jl:1806
[10] #invoke_in_world#3
@ Base .\essentials.jl:921 [inlined]
[11] invoke_in_world
@ Base .\essentials.jl:918 [inlined]
[12] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base .\loading.jl:1797
[13] macro expansion
@ Base .\loading.jl:1784 [inlined]
[14] macro expansion
@ Base .\lock.jl:267 [inlined]
[15] __require(into::Module, mod::Symbol)
@ Base .\loading.jl:1747
[16] #invoke_in_world#3
@ Base .\essentials.jl:921 [inlined]
[17] invoke_in_world
@ Base .\essentials.jl:918 [inlined]
[18] require(into::Module, mod::Symbol)
@ Base .\loading.jl:1740

parameters

The error message suggests:

Please run Pkg.build(“PyCall”)

Did you try that?

If you want to use PyPlot you have two options:

  1. you have Python and Matplotlib already installed on your computer and want to use the installed version. In this case, use Pkg.build("PyCall") to make it work
  2. you do not have this installed and want Julia to install it for you. In this case, execute:
ENV["PYTHON"]=""
Pkg.build("PyCall")

as suggested in the documentation.
`

3 Likes

One reason I asked for your OS is because some problems are OS-specific. Sometimes providing that information can be difference between getting a solution and not. If ufechner7 is correct, you might try the solution the community guided me to here.

He has the drive letter in the error messages, so I assume it is Windows…

1 Like