# PackageCompiler hangs while compiling nonincremental system image on Julia v1.11

**URL:** <https://discourse.julialang.org/t/packagecompiler-hangs-while-compiling-nonincremental-system-image-on-julia-v1-11/128099>\
**Category:** General Usage\
**Created:** [April 15, 2025, 2:31pm UTC](https://discourse.julialang.org/t/packagecompiler-hangs-while-compiling-nonincremental-system-image-on-julia-v1-11/128099 "2025-04-15T14:31:09Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![uwestoehr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/uwestoehr/32/216201_2.png) [@uwestoehr](https://discourse.julialang.org/u/uwestoehr)\
**Post date:** [April 13, 2025, 2:45pm UTC](https://discourse.julialang.org/t/packagecompiler-hangs-while-compiling-nonincremental-system-image-on-julia-v1-11/128099/14 "2025-04-13T14:45:57Z")

</div>

After many hours of trying I found the solution and the bug in _PackageCompiler_.

### At first the step by step instruction:

1. Assure that the python.exe is in the PATH environment variable (either the one of the current user or the system-wide one)
2. Assure that you don’t have a Julia thread setting as environment variable, so there must not be an environment variable called `JULIA_NUM_THREADS`
3. Start Julia and change to the source directory, for example: `cd("D:\\Julia")`
4. Execute `using PackageCompiler`
5. Execute this command:

```using
create_library("MyLib", "MyLibCompiled";
                lib_name="libinc",
                precompile_execution_file="D:\\Julia\\MyLib\\build\\generate_precompile.jl",
                precompile_statements_file="D:\\\Julia\\MyLib\\build\\additional_precompile.jl",
                header_files = ["D:\\Julia\\MyLib\\build\\mylib.h"])

```

whereas “MyLib” is the name of the subfolder of “D:\Julia” (so “D:\Julia\MyLib”), “LyLibCompiled” will become a new folder with the compilation results. “libinc” will be the name of the created library (“libinc.dll”). For the statements of `precompile_execution_file` etc. take the skeleton of the files and file structure given in the [examples folder](https://github.com/JuliaLang/PackageCompiler.jl/tree/master/examples) of the _PackageCompiler_ docs.

### The bug making PackageCompiler failing

Since my application are neuronal networks and the computation time reduces a lot when using multiple of the CPU threads, I use the environment variable [JULIA\_NUM\_THREADS](https://docs.julialang.org/en/v1/manual/environment-variables/#JULIA_NUM_THREADS)  
But if this is set, no matter to what value, _PackageCompiler_ runs forever, not creating any library or app and you also get no information why it fails.

---

_[View the full topic](https://discourse.julialang.org/t/packagecompiler-hangs-while-compiling-nonincremental-system-image-on-julia-v1-11/128099)._
