# Why am I unable to precompile my project?

**URL:** <https://discourse.julialang.org/t/why-am-i-unable-to-precompile-my-project/93832>\
**Category:** General Usage\
**Tags:** question, package, environment\
**Created:** [January 31, 2023, 5:28pm UTC](https://discourse.julialang.org/t/why-am-i-unable-to-precompile-my-project/93832 "2023-01-31T17:28:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kannan975](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kannan975/32/46413_2.png) [@kannan975](https://discourse.julialang.org/u/kannan975)\
**Post date:** [January 31, 2023, 5:28pm UTC](https://discourse.julialang.org/t/why-am-i-unable-to-precompile-my-project/93832/1 "2023-01-31T17:28:59Z")

</div>

Hi,  
I am quite new to Julia and I am trying to working on and developing a package that my colleague has made.

Following the instructions on [pkgdocs](https://pkgdocs.julialang.org/v1/environments/), I used `dev` to clone the project followed by `activate .` and `instantiate`

When I tried to instantiate I got the first error:

> Warning: The project dependencies or compat requirements have changed since the manifest was last resolved.  
> │ It is recommended to `Pkg.resolve()` or consider `Pkg.update()` if necessary.  
> └ @ Pkg.API C:\workdir\usr\share\julia\stdlib\v1.8\Pkg\src\API.jl:1535  
> ERROR: `Interpolations` is a direct dependency, but does not appear in the manifest. If you intend `Interpolations` to be a direct dependency, run `Pkg.resolve()`

After performing `Pkg.resolve()`, upon trying to instatitate again it fails to precompile.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/2/0/203aa8039dc74077b8b71400e2d06d9a780fd81b.png)

Any help would be appreciated 🙂  
I am using Windows 11 and Julia 1.8.5 (same issue happened on v1.8.3)

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [January 31, 2023, 5:33pm UTC](https://discourse.julialang.org/t/why-am-i-unable-to-precompile-my-project/93832/2 "2023-01-31T17:33:53Z")

</div>

I would focus on this error now : `UndefVarError: Event is not defined`. Look through your colleague’s code. How is `Event` supposed to be defined?

---

<div class="post-metadata">

**Author:** ![kannan975](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kannan975/32/46413_2.png) [@kannan975](https://discourse.julialang.org/u/kannan975)\
**Post date:** [January 31, 2023, 5:44pm UTC](https://discourse.julialang.org/t/why-am-i-unable-to-precompile-my-project/93832/3 "2023-01-31T17:44:35Z")

</div>

It is defined as `mutable struct Event`

The project seems to be working perfectly fine for him.

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [January 31, 2023, 5:52pm UTC](https://discourse.julialang.org/t/why-am-i-unable-to-precompile-my-project/93832/4 "2023-01-31T17:52:22Z")

</div>

is `BosonSampling.jl` a github repo we can take a look?

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [January 31, 2023, 6:23pm UTC](https://discourse.julialang.org/t/why-am-i-unable-to-precompile-my-project/93832/5 "2023-01-31T18:23:46Z")

</div>

This one perhaps?

> **[GitHub - benoitseron/BosonSampling.jl: Boson sampling tools for Julia](https://github.com/benoitseron/BosonSampling.jl)**
>
> Boson sampling tools for Julia. Contribute to benoitseron/BosonSampling.jl development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [January 31, 2023, 6:55pm UTC](https://discourse.julialang.org/t/why-am-i-unable-to-precompile-my-project/93832/6 "2023-01-31T18:55:32Z")

</div>

Eight days ago your colleague made this commit introducing a reference to `Event` in measurement.jl:

> <https://github.com/benoitseron/BosonSampling.jl/commit/e06d6645a9d6b6fe862fe02123ab73d4d83e8874>

However, in types.jl, measurements.jl is loaded before events.jl.

> <https://github.com/benoitseron/BosonSampling.jl/blob/4ea000d252e7e3da26c3b003c77c962d22240aa9/src/types/types.jl#L7-L8>

The code in measurements.jl does not know about the mutable struct declared in events.jl. The solution to this is to move all the type declarations to a file included before all the function definitions.

A simple solution for now is to move `possible_threshold_detections` to events.jl instead of measurements.jl

> <https://github.com/benoitseron/BosonSampling.jl/blob/4ea000d252e7e3da26c3b003c77c962d22240aa9/src/types/measurements.jl#L63-L78>

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [January 31, 2023, 6:58pm UTC](https://discourse.julialang.org/t/why-am-i-unable-to-precompile-my-project/93832/7 "2023-01-31T18:58:37Z")

</div>

Look what I found in events.jl:

> <https://github.com/benoitseron/BosonSampling.jl/blob/4ea000d252e7e3da26c3b003c77c962d22240aa9/src/types/events.jl#L146-L159>

It looks to me like your colleague forgot to commit one or more files. It does not make sense for `possible_threshold_detections(ev::Event)` to be defined twice.

---

<div class="post-metadata">

**Author:** ![kannan975](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kannan975/32/46413_2.png) [@kannan975](https://discourse.julialang.org/u/kannan975)\
**Post date:** [January 31, 2023, 8:54pm UTC](https://discourse.julialang.org/t/why-am-i-unable-to-precompile-my-project/93832/8 "2023-01-31T20:54:11Z")

</div>

Yes! That was indeed the problem. I guess it wasn’t a Julia problem after all, but a little software development bug.

Thanks a lot for quickly troubleshooting it @mkitti
