Relais quantique

Hi Julia Community,
these past couple of months i’ve been trying to run a code with some packages a i have started with the functions or the packages in order to call them in the main code, the packages are: utility, distrubitions, scanner, operateurs, you will find the names on the code.
the packages are good right now and my problem right now is with the main code which is everything this is the main code:

module QuantumRelay

using SymPy
using Iterators
using PolyLib
using JuMP
using Clp
using LLLplus
using GSL
using PyPlot
using Lora
using Distributions



type QRelaySampler
	prob::Function #return the probablility
	psetproposal::Function #return next combination of sample

    #input parameters:
    #mat: the matrix p_ij in the note (10)
    #coef: the coefficient c in the note (10)
    #omega: the coefficient A in the note (10)
    #pdet0: the probability of detection for each detector
	function QRelaySampler{T<:Int}(mat::Array{T, 2}, coef, omega, pdet0)
		U, S, V = PolyLib.smith_normal_form(mat) #note (18)
        #the PolyLib returns P=USV. Inverse the matrices so Ui/Vi is the same as U/V in the note (18)
		Ui = PolyLib.inverse(U) 
		Vi = PolyLib.inverse(V)
		s = diag(S)
		r = countnz(s)
		s0 = s[1:r]
		@assert s0 == ones(r)
		ui1 = Ui[1:r, :]
		ui2 = Ui[r+1:end, :]
		vi1 = Vi[:, 1:r]
		vi2 = Vi[:, r+1:end]
		vi2 = lll(vi2)[1] #Lenstra–Lenstra–Lovász lattice basis reduction
		T0 = vi1*ui1
		ui2oc = orthocomp(ui2) #orhogonal complement
		setc, scan = scan_maker(vi2) #make the scanner for the algorithm1 in the note
        #compute the probability for an ideal system
        #na: the photon numbers in a output mode
		function prob(na)
		    @assert countnz(ui2*na) == 0
		    b = T0*na
		    total = 0.0
		    for x in Task(scan)
		        nab = vi2*x + b #the photon numbers for each item in the sum in the note (10)
		        total += prod([c.^complex(n)/factorial(n) for (c, n) in zip(coef, nab)])
		    return abs(total*omega)^2

        #compute the probability of detection
        #q: the number of photons detectors report
        #na: the number of photons arrived at detector
        #mask: if there is no detector in this channel, mask=0
		function prob(q, na, mask)
		    q0 = round(Int, q.>0)
		    m0 = round(Int, mask)
		    return prod((q0 + (1-2q0).*pdet0(na)).^m0)

		psetproposal(x::Vector) = QuantumRelay.OrthoNNDist(x, ui2oc)

		new(prob, psetproposal)


and this is what it shows me after running it:

Warning: Deprecated syntax type at REPL[7]:25.
│ Use mutable struct instead.
└ @ REPL[7]:25
WARNING: replacing module QuantumRelay.
[ Info: Precompiling SymPy [24249f21-da20-56a4-8eb1-6a02cf4ae2e6]
ERROR: LoadError: LoadError: PyCall not properly installed. Please run“PyCall”)
[1] error(::String) at ./error.jl:33
[2] top-level scope at /Users/midow/.julia/packages/PyCall/0jMpb/src/startup.jl:44 [inlined]
[3] top-level scope at ./none:0
[4] include at ./boot.jl:317 [inlined]
[5] include_relative(::Module, ::String) at ./loading.jl:1038
[6] include at ./sysimg.jl:29 [inlined]
[7] include(::String) at /Users/midow/.julia/packages/PyCall/0jMpb/src/PyCall.jl:3
[8] top-level scope at none:0
[9] include at ./boot.jl:317 [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:319 [inlined]
[14] eval(::Expr) at ./client.jl:399
[15] top-level scope at ./none:3
in expression starting at /Users/midow/.julia/packages/PyCall/0jMpb/src/startup.jl:41
in expression starting at /Users/midow/.julia/packages/PyCall/0jMpb/src/PyCall.jl:37
ERROR: LoadError: Failed to precompile PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45ab0] to /Users/midow/.julia/compiled/v0.7/PyCall/GkzkC.ji.
[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/midow/.julia/packages/SymPy/XFURz/src/SymPy.jl:35
ERROR: Failed to precompile SymPy [24249f21-da20-56a4-8eb1-6a02cf4ae2e6] to /Users/midow/.julia/compiled/v0.7/SymPy/KzewI.ji.
[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

You are probably running code written for a (much) earlier version of Julia (note the first message).

You can

and if you still encounter errors, reduce your problem to a minimal self-contained example.


all the packages are run in Julia 0.7 this code also but i don’t know whta’s wrong because i was suprised with the numbers of errors in this code despite that the syntax is fine…

Please consider the post linked by @Tamas_Papp, it will be very hard to help you without an MWE.

Have you tried doing what the Error message suggests (i.e. pkg> build PyCall)?

1 Like

of course i am considering the post linked by @Tamas_Papp, in fact i have faced this problem at first when i wanted to star running my packages i started by using Julia 1.0 and then i knew that Julia 0.7 is stable and it worked, all the packages worked without any problem Julia 0.7 gave me all the suggestions that i should do for my packages and when i continued by coding my main code and calling the packages as u can see in the code i was suprised by the errors and now i am building the Pycall, hopefully i will work.

Perhaps you could try for a shorter code extract illustrating the problem you see, or at least post (or link to ) the exact code you’re having problems with. The formatting in your original post makes it hard to tell what’s going on.


Sure why not this is the link of my main code:


but right now i am having a problem with the Polylib Package cause when i wanted to import it it doesn’t want to it shows me this message:
ERROR: The following package names could not be resolved:

  • PolyLib (not found in project, manifest or registry)
    Please specify by known name=uuid.

and i don’t know whta’s wrong with it and i really need it for this code.

Unfortunately, this is a link to your own computer.

You should post plain code (either in a comment with backticks, or possibly a gist on Github). The shorter it is, the higher are the chances that you get help.


@Tamas_Papp i was thinking that i have already quoted the code, i have edited it right now with the backsticks and you can see the code on the post and this code it’s not big as it was this is the shortest version of it that i could do because it’s devided on 5 parts 4 codes as a Package and one main code which is on the post it could never be shorter.

Your code includes files which we don’t see, so it is not self-contained.

Since you consistently ignore the request for an MWE, I am sorry to say that I cannot help you.

If you cannot share your code in public, perhaps you should consider hiring a paid consultant — see the jobs category.

i will post all the code in Github and Put the Link on the comment.

I’m not sure using another outlet to post even more code will necessarily be helpful… What @Tamas_Papp is trying to say is that to be in the best position to help you, people on this forum need an MWE, that is a

  • Minimal - i.e. code that is as short as possible to illustrate the problem;
  • Working - i.e. self contained so that everyone with a Julia installation can copy/past the code and run it on their own machine;
  • Example

What you have provided so far fails on both M and W counts. Initially, you posted a stacktrace that indicated a problem with your PyPlot installation, for which the MWE could have literally been

julia> using PyPlot

You now seem to have moved on to a different problem related to (potentially!?) PolyLib - again without showing a minimal working snippet of code that actually produces the error.

I would therefore recommend that before dumping large codebases onto GitHub you could try to isolate the smallest subsection of your code that produces the error you’re stuck at, and then post this here (while removing any references to files on your local machine).


thank you very much for the idea, to be honest i am not familiar with those MWE i just code the way i feel it right, and this code has been torturing me for a long time i have done all the packages they work and the main code there is something missing so i just tried to run the code by dividing it into small parts and the first problem that i have is the PolyLib Package, i don’t know whta’s wrong with it it doesn’t want to run and i don’t understand the message that the machine shows me.

@Tamas_Papp this is the link of the entire code on Github:

There is little point in responding to me with the same message multiple times — unfortunately, I cannot provide you any help since your example is neither minimal, nor in plain Julia (sorry, notebooks are too much of a hassle).