# Failure to compile to .exe "LoadError: ArgumentError: Package Base does not have Decimals in its dependencies:"

**URL:** <https://discourse.julialang.org/t/failure-to-compile-to-exe-loaderror-argumenterror-package-base-does-not-have-decimals-in-its-dependencies/101073>\
**Category:** New to Julia\
**Created:** [July 2, 2023, 10:06am UTC](https://discourse.julialang.org/t/failure-to-compile-to-exe-loaderror-argumenterror-package-base-does-not-have-decimals-in-its-dependencies/101073 "2023-07-02T10:06:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![archon](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@archon](https://discourse.julialang.org/u/archon)\
**Post date:** [July 2, 2023, 10:06am UTC](https://discourse.julialang.org/t/failure-to-compile-to-exe-loaderror-argumenterror-package-base-does-not-have-decimals-in-its-dependencies/101073/1 "2023-07-02T10:06:24Z")

</div>

I’m an apprentice for development working with C# and a few months ago I have been playing around with basics of Julia whenever I have some free time. I am still learning. I decided to start a small project calculating the average grade after receiving grades in school subjects. My problem is, I can’t compile it to an .exe and I am out of options. ☹ The links lead you to the screenshots for the following details.

This is my script:

> **My code**
>
> ```julia
> using Decimals
> module CalculateAverageGrade
> function _calculateAverageGrade()
> list = Array{Int}(undef,11);
> for i in 1:length(list)
> saveInput::String = "";
> validInput::Bool = false;
> while(!validInput)
> saveInput = strip(readline())
> try
> if isempty(saveInput) || !isinteger(parse(Int8, saveInput)) || parse(Int8, saveInput) <= 0 || parse(Int8, saveInput) > 6
> println("Fehlerhafte Eingabe. Wiederhole deine Eingabe:")
> continue
> else
> validInput = true;
> end 
> catch e
> println("Fehlerhafte Eingabe. Wiederhole deine Eingabe:")
> continue
> end           
> end
> grade::Int8 = parse(Int8, saveInput);
> list[i] = grade;
> end
> averageGrade = decimal(sum(list) / length(list))
> println("Dein Notendurchschnitt ist: $averageGrade")
> readline()
> clear()
> end
> 
> function julia_main()
> _calculateAverageGrade()
> end
> end
> 
> ```

You are free to give me feedbacks how to improve the code.

From what I have learned, in order to compile a project to an .exe, the .jl file needs to be in `/<Projectname>/src/`. In `/src` needs to be the desired .jl file with the same name as the main project folder.

> **Images**
>
> [https://abload.de/img/untitled-290doj.jpg](https://abload.de/img/untitled-290doj.jpg)

In the REPL, I change the directory to `\julia\CalculateAverageGrade`, then `]`, `activate .`, `add PackageCompiler` and then I get the following output:

> **1st Output**
>
> [https://abload.de/img/untitled-3bles9.jpg](https://abload.de/img/untitled-3bles9.jpg)

With `import Pkg; Pkg.precompile()` I get the following:

> **2nd Output**
>
> ![image](https://global.discourse-cdn.com/julialang/original/3X/c/7/c766b4a4f87edfaebbb75923fa11aedd8ac0eca0.png)

And finally…

```julia
julia> create_app("CalculateAverageGrade.jl", "_Compiled")
ERROR: could not find project at "CalculateAverageGrade.jl"

```

although I confirmed with `pwd()` I am in the project folder.

The REPL said I should use `Pkg.resolve()` or `Pkg.instantiate()` but this didn’t solve anything.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [July 2, 2023, 11:26am UTC](https://discourse.julialang.org/t/failure-to-compile-to-exe-loaderror-argumenterror-package-base-does-not-have-decimals-in-its-dependencies/101073/2 "2023-07-02T11:26:28Z")

</div>

Probably you should move `using Decimals` inside the module (see [Loading package outside of main module when precompiling could have better error message · Issue #45832 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/45832)).

---

<div class="post-metadata">

**Author:** ![archon](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@archon](https://discourse.julialang.org/u/archon)\
**Post date:** [July 2, 2023, 1:21pm UTC](https://discourse.julialang.org/t/failure-to-compile-to-exe-loaderror-argumenterror-package-base-does-not-have-decimals-in-its-dependencies/101073/3 "2023-07-02T13:21:12Z")

</div>

Thanks for the reply. I put `using Decimals` below `module`.  
However, I still get this message

```julia
ERROR: LoadError: ArgumentError: Package CalculateAverageGrade does not have Pkg in its dependencies:

```

I went back to REPL and executed `using Pkg; Pkg.add("Decimals")` to no avail. I get the same suggestions executing `Pkg.instantiate()` and `Pkg.resolve()` and the latter results to `No changes to [...]` in the REPL.

---

<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:** [July 2, 2023, 1:36pm UTC](https://discourse.julialang.org/t/failure-to-compile-to-exe-loaderror-argumenterror-package-base-does-not-have-decimals-in-its-dependencies/101073/4 "2023-07-02T13:36:02Z")

</div>

Did you activate your package’s environment before adding the dependency?

---

<div class="post-metadata">

**Author:** ![archon](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@archon](https://discourse.julialang.org/u/archon)\
**Post date:** [July 2, 2023, 2:52pm UTC](https://discourse.julialang.org/t/failure-to-compile-to-exe-loaderror-argumenterror-package-base-does-not-have-decimals-in-its-dependencies/101073/5 "2023-07-02T14:52:16Z")

</div>

Thank you. That did the trick.  
In the REPL:

```julia
]
activate .
(MyPackage) pkg> add <NameOfPackage>

```

In this case “” was “Decimals”.  
Then I copied the contents of Manifest.toml into the same named file in my project folder. Lastly, I copied over the line `Decimals = "<UUID>"` from Project.toml to the same named file in my project folder.  
Compiling my project was a success.

Edit: Forgot to mention that the error message should give the suggestion to add the necessary package with the aformentioned steps if it wasn’t done previously.
