# @everywhere and PackageCompiler build\_executable()

**URL:** <https://discourse.julialang.org/t/everywhere-and-packagecompiler-build-executable/16121>\
**Category:** General Usage\
**Created:** [October 10, 2018, 3:20pm UTC](https://discourse.julialang.org/t/everywhere-and-packagecompiler-build-executable/16121 "2018-10-10T15:20:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![waldoc](https://avatars.discourse-cdn.com/v4/letter/w/ce7236/32.png) [@waldoc](https://discourse.julialang.org/u/waldoc)\
**Post date:** [October 10, 2018, 3:20pm UTC](https://discourse.julialang.org/t/everywhere-and-packagecompiler-build-executable/16121/1 "2018-10-10T15:20:08Z")

</div>

I am trying to build an executable using a package I created. The code makes use of pmap to run on multiple workers.

I created a new module with the function name as per PackageCompiler recommendations and compiled with `build_executable()`. This all worked fine, created an .exe that does what it is expected.

However, I need to run my code in parallel. When i use the package normally I would type: `@everywhere using PkgX` when loading the package and use `pmap` to execute the function contained in PkgX. This works well when using the package within Julia code.

If I add the line `@everywhere using PkgX` within the function (`julia_main`) I get a build error. Without it, the functions of interest are not distributed to the workers and therefore as soon as I `addprocs(x)` the executable no longer works (the same code works on a single worker).

Any ideas? Thanks!

---

<div class="post-metadata">

**Author:** ![ConnectedSystems](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/connectedsystems/32/16815_2.png) [@ConnectedSystems](https://discourse.julialang.org/u/ConnectedSystems)\
**Post date:** [May 21, 2022, 9:33am UTC](https://discourse.julialang.org/t/everywhere-and-packagecompiler-build-executable/16121/2 "2022-05-21T09:33:44Z")

</div>

This is several years late but in case useful to others, I’ve into the same/similar issue and resolved with:

```julia
@eval @everywhere begin
    using Statistics
end

```

This is for `create_app()`, which I assume has replaced `build_executable()` in the past 4 years or so.
