# ERROR: LoadError: LoadError: UndefVarError: n\_actions not defined

**URL:** <https://discourse.julialang.org/t/error-loaderror-loaderror-undefvarerror-n-actions-not-defined/67095>\
**Category:** New to Julia\
**Created:** [August 27, 2021, 11:43am UTC](https://discourse.julialang.org/t/error-loaderror-loaderror-undefvarerror-n-actions-not-defined/67095 "2021-08-27T11:43:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![stajyerbob](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stajyerbob/32/28623_2.png) [@stajyerbob](https://discourse.julialang.org/u/stajyerbob)\
**Post date:** [August 27, 2021, 11:43am UTC](https://discourse.julialang.org/t/error-loaderror-loaderror-undefvarerror-n-actions-not-defined/67095/1 "2021-08-27T11:43:30Z")

</div>

hey all, I tried to run [SolveMDP.jl](https://github.com/sisl/HorizontalCAS) this code in julia1.1.1 on wsl ubuntu. I have installed all packages required but I had such an error::  
“”–ERROR: LoadError: LoadError: UndefVarError: n\_actions not defined  
Stacktrace:  
[1] getproperty(::Module, ::Symbol) at ./sysimg.jl:13  
[2] top-level scope at none:0  
[3] include at ./boot.jl:326 [inlined]  
[4] include\_relative(::Module, ::String) at ./loading.jl:1038  
[5] include at ./sysimg.jl:29 [inlined]  
[6] include(::String) at /home/xxxx/HorizontalCAS/GenerateTable/mdp/HCAS.jl:1  
[7] top-level scope at none:0  
[8] include at ./boot.jl:326 [inlined]  
[9] include\_relative(::Module, ::String) at ./loading.jl:1038  
[10] include(::Module, ::String) at ./sysimg.jl:29  
[11] top-level scope at none:2  
[12] eval at ./boot.jl:328 [inlined]  
[13] eval(::Expr) at ./client.jl:404  
[14] top-level scope at ./none:3""  
Could you please help me to overcome this error?

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [August 27, 2021, 12:46pm UTC](https://discourse.julialang.org/t/error-loaderror-loaderror-undefvarerror-n-actions-not-defined/67095/2 "2021-08-27T12:46:23Z")

</div>

Welcome! There’s no example for us to run here, so we can’t really help you much. Please provide a minimal (non-)working example for us to run.

> [@Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757):
>
> Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer. Keywords are highlighted to make it easier to refer to specific points. Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …

---

<div class="post-metadata">

**Author:** ![stajyerbob](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stajyerbob/32/28623_2.png) [@stajyerbob](https://discourse.julialang.org/u/stajyerbob)\
**Post date:** [August 27, 2021, 1:18pm UTC](https://discourse.julialang.org/t/error-loaderror-loaderror-undefvarerror-n-actions-not-defined/67095/3 "2021-08-27T13:18:53Z")

</div>

> [@Sukera](#):
>
> provide

I don’t have such a minimal example. Project is prettty complex. [MDP](https://github.com/sisl/HorizontalCAS/tree/master/GenerateTable) I end up with given error when SolveMDP.jl is runned

---

<div class="post-metadata">

**Author:** ![stajyerbob](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stajyerbob/32/28623_2.png) [@stajyerbob](https://discourse.julialang.org/u/stajyerbob)\
**Post date:** [August 27, 2021, 1:20pm UTC](https://discourse.julialang.org/t/error-loaderror-loaderror-undefvarerror-n-actions-not-defined/67095/4 "2021-08-27T13:20:05Z")

</div>

relevant part of the code is  
“# Define necessary functions for HCAS MDP  
POMDPs.actionindex(::HCAS\_MDP, a::actType) = a + 1  
POMDPs.actions(mdp::HCAS\_MDP) = ACTIONS  
POMDPs.discount(mdp::HCAS\_MDP) = mdp.discount\_factor  
POMDPs.n\_actions(::HCAS\_MDP) = length(ACTIONS)” which is a part from h\_CAS.jl

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [August 27, 2021, 1:29pm UTC](https://discourse.julialang.org/t/error-loaderror-loaderror-undefvarerror-n-actions-not-defined/67095/5 "2021-08-27T13:29:44Z")

</div>

I think an MWE is quite simple in this case:

```julia
julia> using POMDPs

julia> POMDPs.n_actions
ERROR: UndefVarError: n_actions not defined
Stacktrace:
 [1] getproperty(x::Module, f::Symbol)
   @ Base .\Base.jl:35
 [2] top-level scope
   @ REPL[16]:100: 

```

I don’t know what the `POMDPs` package is or does, why do you think it should have an `n_actions` function? Often these kinds of errors arise from copying example code written for older versions of a package.

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [August 27, 2021, 1:44pm UTC](https://discourse.julialang.org/t/error-loaderror-loaderror-undefvarerror-n-actions-not-defined/67095/6 "2021-08-27T13:44:16Z")

</div>

There doesn’t seem to be any `Project.toml` (where package dependencies are recorded) or `Manifest.toml` (where versions of used dependencies are recorded) present in that repo. I agree with @nilshg - make sure you have the versions of the packages used by the original author of that paper installed. It’s a shame they don’t seem to provide it in the repo, especially since julia usually makes it rather easy to do so. Your best bet is probably contacting the authors and seeing if you can find out which version of each dependency was used.

One option would be to try the version from this PR, where another kind soul already did that grunt work. Why it wasn’t merged in the end, I don’t know.

[https://github.com/sisl/HorizontalCAS/pull/5](https://github.com/sisl/HorizontalCAS/pull/5)

According to that PR, `POMDPs` is supposed to be version `0.7.0` - while the most up to date version is `0.9.3`. Can you post the output of `]st` from the REPL, so we can check which version you have installed?

---

<div class="post-metadata">

**Author:** ![stajyerbob](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stajyerbob/32/28623_2.png) [@stajyerbob](https://discourse.julialang.org/u/stajyerbob)\
**Post date:** [August 27, 2021, 1:58pm UTC](https://discourse.julialang.org/t/error-loaderror-loaderror-undefvarerror-n-actions-not-defined/67095/7 "2021-08-27T13:58:56Z")

</div>

How can I remove all packages and reinstall ?

---

<div class="post-metadata">

**Author:** ![stajyerbob](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stajyerbob/32/28623_2.png) [@stajyerbob](https://discourse.julialang.org/u/stajyerbob)\
**Post date:** [August 28, 2021, 5:48am UTC](https://discourse.julialang.org/t/error-loaderror-loaderror-undefvarerror-n-actions-not-defined/67095/8 "2021-08-28T05:48:14Z")

</div>

Thank you all! removing and reinstalling all packages worked for that error. Now I have different kind of error  
"ERROR: LoadError: ProcessExitedException()  
Stacktrace:  
[1] worker\_from\_id(::Distributed.ProcessGroup, ::Int64) at /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.1/Distributed/src/cluster.jl:969  
[2] worker\_from\_id at /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.1/Distributed/src/cluster.jl:966 [inlined]  
[3] #remotecall\_fetch#152 at /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.1/Distributed/src/remotecall.jl:406 [inlined]  
[4] remotecall\_fetch at /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.1/Distributed/src/remotecall.jl:406 [inlined]  
[5] call\_on\_owner at /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.1/Distributed/src/remotecall.jl:479 [inlined]  
[6] fetch(::Future) at /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.1/Distributed/src/remotecall.jl:511  
[7] compute\_trans\_reward(::Array{Union{MDP, POMDP},1}, ::LocalGIFunctionApproximator{RectangleGrid{6}}, ::Int64) at /mnt/c/Users/PC\_2219/Desktop/project\_folder/bu\_son\_olsun/HorizontalCAS/GenerateTable/SolveMDP.jl:97  
[8] computeQ(::Array{Union{MDP, POMDP},1}, ::LocalGIFunctionApproximator{RectangleGrid{6}}, ::Int64, ::Int64) at /mnt/c/Users/xxx/Desktop/project\_folder/xxxxx/HorizontalCAS/GenerateTable/SolveMDP.jl:105

---

<div class="post-metadata">

**Author:** ![stajyerbob](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stajyerbob/32/28623_2.png) [@stajyerbob](https://discourse.julialang.org/u/stajyerbob)\
**Post date:** [August 28, 2021, 7:29am UTC](https://discourse.julialang.org/t/error-loaderror-loaderror-undefvarerror-n-actions-not-defined/67095/9 "2021-08-28T07:29:26Z")

</div>

Worker 3 terminated.ERROR:  
LoadError: ProcessExitedException()  
Stacktrace:  
[1] try\_yieldto(::typeof(Base.ensure\_rescheduled), ::Base.RefValue{Task}) at ./event.jl:196  
[2] wait() at ./event.jl:255  
[3] wait(::Condition) at ./event.jl:46  
[4] take\_buffered(::Channel{Any}) at ./channels.jl:362  
[5] take!(::Channel{Any}) at ./channels.jl:315  
[6] take!(::Distributed.RemoteValue) at /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.1/Distributed/src/remotecall.jl:576  
[7] #remotecall\_fetch#149(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Function, ::Distributed.Worker, ::Distributed.RRID) at /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.1/Distributed/src/remotecall.jl:375  
[8] remotecall\_fetch(::Function, ::Distributed.Worker, ::Distributed.RRID, ::Vararg{Any,N} where N) at /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.1/Distributed/src/remotecall.jl:371  
[9] #remotecall\_fetch#152 at /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.1/Distributed/src/remotecall.jl:406 [inlined]  
[10] remotecall\_fetch at /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.1/Distributed/src/remotecall.jl:406 [inlined]  
[11] call\_on\_owner at /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.1/Distributed/src/remotecall.jl:479 [inlined]  
[12] fetch(::Future) at /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.1/Distributed/src/remotecall.jl:511

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [August 28, 2021, 8:29am UTC](https://discourse.julialang.org/t/error-loaderror-loaderror-undefvarerror-n-actions-not-defined/67095/10 "2021-08-28T08:29:16Z")

</div>

Again, can you post the code that leads to this error? While having an error message is useful, not being able to investigate the code leading to it is detrimental to getting help. Purely from the error, it seems like one of the worker processes used by `Distributed` is crashing, leading to the error. Whether that is because of your cluster or your code, I can’t say.
