Error when loading Distributions package for parallel computing

I’m using parallel computing for some parts of my Julia code and for that, I need to load 2 packages: LinearAlgebra and Distributions. Concerning LinearAlgebra I run the following code and it works:

using Distributed
using LinearAlgebra
using Distributions
addprocs(1)
@everywhere using LinearAlgebra

But when I try @everywhere using Distributions I have the following error:

On worker 2:
ArgumentError: Package Distributions not found in current path:
- Run `import Pkg; Pkg.add("Distributions")` to install the Distributions package.
require at .\loading.jl:823
eval at .\boot.jl:328
#116 at C:\Users\julia\AppData\Local\Julia-1.1.1\share\julia\stdlib\v1.1\Distributed\src\process_messages.jl:276
run_work_thunk at C:\Users\julia\AppData\Local\Julia-1.1.1\share\julia\stdlib\v1.1\Distributed\src\process_messages.jl:56
run_work_thunk at C:\Users\julia\AppData\Local\Julia-1.1.1\share\julia\stdlib\v1.1\Distributed\src\process_messages.jl:65
#102 at .\task.jl:259
#remotecall_wait#154(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Function, ::Distributed.Worker, ::Module, ::Vararg{Any,N} where N) at C:\Users\julia\AppData\Local\Julia-1.1.1\share\julia\stdlib\v1.1\Distributed\src\remotecall.jl:421
remotecall_wait(::Function, ::Distributed.Worker, ::Module, ::Vararg{Any,N} where N) at C:\Users\julia\AppData\Local\Julia-1.1.1\share\julia\stdlib\v1.1\Distributed\src\remotecall.jl:412
#remotecall_wait#157(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Function, ::Int64, ::Module, ::Vararg{Any,N} where N) at C:\Users\julia\AppData\Local\Julia-1.1.1\share\julia\stdlib\v1.1\Distributed\src\remotecall.jl:433
remotecall_wait(::Function, ::Int64, ::Module, ::Vararg{Any,N} where N) at C:\Users\julia\AppData\Local\Julia-1.1.1\share\julia\stdlib\v1.1\Distributed\src\remotecall.jl:433
(::getfield(Distributed, Symbol("##161#163")){Module,Expr})() at .\task.jl:259
sync_end(::Array{Any,1}) at task.jl:226
macro expansion at task.jl:245 [inlined]
remotecall_eval(::Module, ::Array{Int64,1}, ::Expr) at macros.jl:199
top-level scope at macros.jl:183

I have the same error with LightGraphs package: @everywhere using LightGraphs doesn’t work.
What am I doing wrong? I’m using JuliaPro v. 1.1 with Julia 1.1.

This might be related to running JuliaPro alongside standard Julia.

See Problems parallelizing declaring used packages - #11 by greg_plowman

See Load modules in several workers - #19 by greg_plowman

2 Likes

Thank you :slight_smile: I know that most of the times the same questions are asked more than once… I try to find similar questions on Google but I’m not able to find them. You guys here are always able to point directly to similar questions :slight_smile: Will try your suggestions and see if I can solve the problem :slight_smile:

Your suggestions worked! Thank you!