# Macro @everywhere

**URL:** <https://discourse.julialang.org/t/macro-everywhere/17917>\
**Category:** General Usage\
**Created:** [November 23, 2018, 5:20pm UTC](https://discourse.julialang.org/t/macro-everywhere/17917 "2018-11-23T17:20:20Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![HerAdri](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heradri/32/5816_2.png) [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Post date:** [November 23, 2018, 5:20pm UTC](https://discourse.julialang.org/t/macro-everywhere/17917/1 "2018-11-23T17:20:20Z")

</div>

I tried running some scripts that use @everywhere.  
And I receive the following Alert:

> LoadError: LoadError: UndefVarError: @everywhere not defined  
> in expression starting at D: \ Julia SoftWare \ Julia Scripts \ julia-and-julia-sets: 35  
> in expression starting at D: \ Julia SoftWare \ Julia Scripts \ julia-and-julia-sets: 35  
> top-level scope

When inquiring into the file [exports.jl](https://github.com/JuliaLang/julia/blob/master/base/exports.jl), of my Julia installation, this macro is not included!  
Where do I look for or how to include this macro?

Gracias

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [November 23, 2018, 5:21pm UTC](https://discourse.julialang.org/t/macro-everywhere/17917/2 "2018-11-23T17:21:58Z")

</div>

```julia
using Distributed

```

---

<div class="post-metadata">

**Author:** ![HerAdri](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heradri/32/5816_2.png) [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Post date:** [November 23, 2018, 5:56pm UTC](https://discourse.julialang.org/t/macro-everywhere/17917/3 "2018-11-23T17:56:11Z")

</div>

> [@kristoffer.carlsson](#):
>
> using Distributed

now, after including

> using Distributed

I have the following alert:

> LoadError: LoadError: UndefVarError: @parallel not defined
> 
> in expression starting at D:\Julia SoftWare\Julia Scripts\julia-and-julia-sets:41
> 
> in expression starting at D:\Julia SoftWare\Julia Scripts\julia-and-julia-sets:41
> 
> top-level scope

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [November 23, 2018, 5:57pm UTC](https://discourse.julialang.org/t/macro-everywhere/17917/4 "2018-11-23T17:57:58Z")

</div>

Did you try using 0.7 which has all the deprecation warnings? ([PSA: use Julia 0.7 if you are upgrading](https://discourse.julialang.org/t/psa-use-julia-0-7-if-you-are-upgrading/13321))

```julia
julia> @everywhere 1+1
WARNING: Base.@everywhere is deprecated: it has been moved to the standard library package `Distributed`.
Add `using Distributed` to your imports.
 in module Main

julia> @parallel 1+1
┌ Warning: `@parallel` is deprecated, use `@distributed` instead.
│ caller = eval(::Module, ::Any) at boot.jl:319
└ @ Core ./boot.jl:319

```

---

<div class="post-metadata">

**Author:** ![HerAdri](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heradri/32/5816_2.png) [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Post date:** [November 23, 2018, 6:08pm UTC](https://discourse.julialang.org/t/macro-everywhere/17917/5 "2018-11-23T18:08:25Z")

</div>

> [@kristoffer.carlsson](#):
>
> @distributed

I try to run the following lines of code:

```julia

@everywhere julia = julia
@everywhere julia_set = julia_set

# Re-write our code to generate the sets in parallel
nr_frames = 40

sets = @sync @parallel append! for n=0:nr_frames
    c = e ^ (2*π*n/nr_frames*im)
    set = julia_set(height, width, c)
    [set]
end

anim = @animate for set in sets
    heatmap(set, size=(width,height), color=:speed, leg=false)
end

file_name = "C:/Users/user/Pictures/julia_$(height)_$(width)_$(nr_frames).gif"
gif(anim, file_name, fps=4)

```

You can help me update them:  
They were taken from:  
[https://hackernoon.com/julia-and-julia-sets-e5a6fa3de7a7](http://julia-and-julia-sets-e5a6fa3de7a7)

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [November 23, 2018, 6:22pm UTC](https://discourse.julialang.org/t/macro-everywhere/17917/6 "2018-11-23T18:22:34Z")

</div>

Did you try to use 0.7 and update the deprecation warnings? What happens after that?

---

<div class="post-metadata">

**Author:** ![HerAdri](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heradri/32/5816_2.png) [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Post date:** [November 23, 2018, 6:23pm UTC](https://discourse.julialang.org/t/macro-everywhere/17917/7 "2018-11-23T18:23:15Z")

</div>

I read:  
[PSA: use Julia 0.7 if you are upgrading()](https://discourse.julialang.org/t/psa-use-julia-0-7-if-you-are-upgrading/13321)  
[Current stable release (v1.0.2)](https://julialang.org/downloads/)

I am using v1.0.2; means that I must install Julia v0.7.0 release.  
Can I install it after having installed v1.0.2?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [November 23, 2018, 6:28pm UTC](https://discourse.julialang.org/t/macro-everywhere/17917/8 "2018-11-23T18:28:54Z")

</div>

Yes, there is no problem having two julias installed at the same time,

---

<div class="post-metadata">

**Author:** ![HerAdri](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heradri/32/5816_2.png) [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Post date:** [November 23, 2018, 7:17pm UTC](https://discourse.julialang.org/t/macro-everywhere/17917/9 "2018-11-23T19:17:13Z")

</div>

I have already installed v0.7.0  
I use Atom  
How to use one or another version. My apologies I am new using Atom and Julia

---

<div class="post-metadata">

**Author:** ![HerAdri](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heradri/32/5816_2.png) [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Post date:** [November 23, 2018, 7:52pm UTC](https://discourse.julialang.org/t/macro-everywhere/17917/10 "2018-11-23T19:52:08Z")

</div>

> [@kristoffer.carlsson](#):
>
> @everywhere 1+1

```
           _

```

\_ \_ _(_)\_ | A fresh approach to technical computing  
(_) | (_) (_) | Documentation: [https://docs.julialang.org](https://docs.julialang.org)  
\_ \_ | | \_\_ \_ | Type “?” for help, “]?” for Pkg help.  
| | | | | | |/ ` | |  
| | || | | | (_| | | Version 0.7.0 (2018-08-08 06:46 UTC)  
_/ |\ __‘_|_|_|\__ ’\_| | Official [http://julialang.org/](http://julialang.org/) release  
|\_\_/ | x86\_64-w64-mingw32

julia\> @everywhere 1+1  
WARNING: Base.@everywhere is deprecated: it has been moved to the standard library package `Distributed`.  
Add `using Distributed` to your imports.  
in module Main  
WARNING: Base.@everywhere is deprecated: it has been moved to the standard library package `Distributed`.  
Add `using Distributed` to your imports.  
in module Main

julia\>

julia\> using Distributed

julia\> @distributed 1+1  
ERROR: LoadError: malformed @distributed loop  
Stacktrace:  
[1] error(::String) at .\error.jl:33  
[2] @distributed(::LineNumberNode, ::Module, ::Vararg{Any,N} where N) at C:\cygwin\home\Administrator\buildbot\worker\package\_win64\build\usr\share\julia\stdlib\v0.7\Distributed\src\macros.jl:329  
in expression starting at REPL[7]:1

julia\> @everywhere 1+1  
WARNING: Base.@everywhere is deprecated: it has been moved to the standard library package `Distributed`.  
Add `using Distributed` to your imports.  
in module Main  
WARNING: Base.@everywhere is deprecated: it has been moved to the standard library package `Distributed`.  
Add `using Distributed` to your imports.  
in module Main

julia\>

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [November 23, 2018, 7:53pm UTC](https://discourse.julialang.org/t/macro-everywhere/17917/11 "2018-11-23T19:53:55Z")

</div>

Yeah, `@distributed` needs a loop like in your example. I just but something stupid like `1+1` to show the deprecation message.

---

<div class="post-metadata">

**Author:** ![HerAdri](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heradri/32/5816_2.png) [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Post date:** [November 23, 2018, 8:41pm UTC](https://discourse.julialang.org/t/macro-everywhere/17917/12 "2018-11-23T20:41:46Z")

</div>

> [@kristoffer.carlsson](#):
>
> @distributed

```julia
#https://hackernoon.com/julia-and-julia-sets-e5a6fa3de7a7
function julia(x, y, width, height, c)
    # Scale size the fractal within our frame
    z = ((y/width)*2.7 - 1.3) + ((x/height)*4.5 - 2.5)im
    for i = 1:255
        z = z^2 + c
        if abs(z) >= 4
            return i
        end
    end
    return -255
end

function julia_set(height, width, c)
    [julia(x, y, width, height, c) for x = 1:height, y = 1:width]
end
# Install the packages we need
#Pkg.add("Plots")
#Pkg.add("GR")
# Import the Plots library in the current runtime
using Plots, Distributed
# Initialize the gr backend
gr()
# Set the size of our images
height = 800
width = 800
c = 1.2*exp(1.1π*im)
# Generate the set
data = julia_set(height, width, c)
# Generate the heatmap and save it as a PNG
file_name = "C:/Users/user/Pictures/julia_$(height)_$(width)_$(c.re)_$(c.im)"
png(heatmap(data, size=(width,height), color=:ice), file_name)

@everywhere julia = julia
@everywhere julia_set = julia_set

# Re-write our code to generate the sets in parallel
nr_frames = 40

sets = @sync @distributed append! for n=0:nr_frames
    c = e ^ (2*π*n/nr_frames*im)
    set = julia_set(height, width, c)
    [set]
end

anim = @animate for set in sets
    heatmap(set, size=(width,height), color=:speed, leg=false)
end

file_name = "C:/Users/user/Pictures/julia_$(height)_$(width)_$(nr_frames).gif"
gif(anim, file_name, fps=4)

```

> Error evaluating julia-and-julia-sets.jl
> 
> LoadError: IOError: could not spawn `ffmpeg -v 0 -i 'C:\Users\user\AppData\Local\Temp\jl_1409.tmp/%06d.png' -vf palettegen=stats_mode=diff -y 'C:\Users\user\AppData\Local\Temp\jl_1409.tmp/palette.bmp'`: no such file or directory (ENOENT)
> 
> in expression starting at D:\Julia SoftWare\Julia Scripts\julia-and-julia-sets.jl:52
> 
> \_jl\_spawn(::String, ::Array{String,1}, ::Cmd, ::Tuple{RawFD,RawFD,RawFD}) at process.jl:370
> 
> (::getfield(Base, Symbol(“##499#500”)){Cmd})(::Tuple{RawFD,RawFD,RawFD}) at process.jl:512
> 
> setup\_stdio(::getfield(Base, Symbol(“##499#500”)){Cmd}, ::Tuple{RawFD,RawFD,RawFD}) at process.jl:493
> 
> #\_spawn#498(::Nothing, ::Function, ::Cmd, ::Tuple{RawFD,RawFD,RawFD}) at process.jl:511
> 
> \_spawn at process.jl:507 [inlined]
> 
> #run#509(::Bool, ::Function, ::Cmd) at process.jl:669
> 
> run at process.jl:668 [inlined]
> 
> #buildanimation#232(::Int64, ::Int64, ::Bool, ::Bool, ::Function, ::String, ::String, ::Bool) at animation.jl:82
> 
> #gif#229 at none:0 [inlined]
> 
> (::getfield(Plots, Symbol(“#kw##gif”)))(::NamedTuple{(:fps,),Tuple{Int64}}, ::typeof(gif), ::Animation, ::String) at none:0
> 
> top-level scope at none:0

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [November 23, 2018, 8:58pm UTC](https://discourse.julialang.org/t/macro-everywhere/17917/13 "2018-11-23T20:58:16Z")

</div>

And do you have `ffmpeg` installed and it can be found in your `PATH `?

---

<div class="post-metadata">

**Author:** ![jlapeyre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlapeyre/32/4514_2.png) [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Post date:** [November 23, 2018, 11:47pm UTC](https://discourse.julialang.org/t/macro-everywhere/17917/14 "2018-11-23T23:47:45Z")

</div>

This happened to me today on a recent build of the master branch.

I think I solved it in the end by doing `pkg> resolve`.

---

<div class="post-metadata">

**Author:** ![HerAdri](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heradri/32/5816_2.png) [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Post date:** [November 24, 2018, 8:06am UTC](https://discourse.julialang.org/t/macro-everywhere/17917/15 "2018-11-24T08:06:42Z")

</div>

I do not have ffmpeg installed!  
What to do? Should I install it?  
This is not a package for video use?

---

<div class="post-metadata">

**Author:** ![HerAdri](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heradri/32/5816_2.png) [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Post date:** [November 24, 2018, 9:05am UTC](https://discourse.julialang.org/t/macro-everywhere/17917/16 "2018-11-24T09:05:56Z")

</div>

I have been installing the following packages to the extent that the systems with their alerts were asking for it:

```julia
VideoIO
Images
ImageView

```

And as a last warning I receive the following:

```julia
LoadError: IOError: write: broken pipe (EPIPE)

in expression starting at D:\Julia SoftWare\Julia Scripts\julia-and-julia-sets.jl:24

```

---

<div class="post-metadata">

**Author:** ![Jan10e](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@Jan10e](https://discourse.julialang.org/u/Jan10e)\
**Post date:** [September 28, 2020, 5:33pm UTC](https://discourse.julialang.org/t/macro-everywhere/17917/17 "2020-09-28T17:33:15Z")

</div>

Hi, This is rather late to the stage, but I found [this issue](https://github.com/JuliaLang/julia/issues/19578) that might help. Changing ‘@parallel’ to ‘@distributed’ in your code should do the job.
