# Julia Crashes withTerminal Process Error when excuting plotting functions from Agents.jl pkg

**URL:** https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063
**Category:** General Usage
**Tags:** vscode, agents
**Created:** [December 14, 2021, 8:38am UTC](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063 "2021-12-14T08:38:22Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![imantha](https://avatars.discourse-cdn.com/v4/letter/i/6a8cbe/32.png) [@imantha](https://discourse.julialang.org/u/imantha)
#### Post date: [December 14, 2021, 8:38am UTC](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063/1 "2021-12-14T08:38:22Z")

</div>

Hi,

Julia crashes with the following error when I execute `abm_plot()` or `abm_play()` functions from `agents.jl` package.

```julia
The terminal process "julia '-i', '--banner=no', '--project=/Users/imantha/.julia/environments/v1.7', '/Users/imantha/.vscode/extensions/julialang.language-julia-1.5.6/scripts/terminalserver/terminalserver.jl', '/var/folders/_1/j0f_5zq95qd_2dpzlmfh8njm0000gn/T/vsc-jl-repl-953781b4-ea37-4157-b1d8-3f66b4098fa6', '/var/folders/_1/j0f_5zq95qd_2dpzlmfh8njm0000gn/T/vsc-jl-cr-cbe88cd0-df11-4fb8-b504-978d30ec9150', 'USE_REVISE=true', 'USE_PLOTPANE=true', 'USE_PROGRESS=true', 'DEBUG_MODE=false'" terminated with exit code: 139.

```

Any Ideas perhaps why?  
Details

- Julia 1.7
- vscode
- macbook pro (m1 chip)

Environment Details

- Agents 4.5.7
- GLMakie 0.4.7
- InteractiveDynamics 0.18.1

Code

```julia
using Pkg
Pkg.activate("envs/abmEnv")
using Agents
using InteractiveDynamics, GLMakie
using Random

# Define Space and Agent type
# --------------------------------------------------------------------------------
space = GridSpace((10,10))
mutable struct Schelling <: AbstractAgent
    id::Int
    pos::Tuple{Int,Int}
    group::Int
    happy::Bool
end

# Initialize Agent Based model
# --------------------------------------------------------------------------------
function initialize(; N = 320, M = 20, min_to_be_happy = 3)
    space = GridSpace((M,M))
    model = AgentBasedModel(
        Schelling,
        space;
        properties = Dict(:min_to_be_happy => min_to_be_happy),
        scheduler = Schedulers.randomly
    )

    for n = 1:N
        agent = Schelling(n, (1,1), (n < N/2) ? 1 : 2, false)
        add_agent_single!(agent, model)
    end

    return model
end

# Agent stepping function
# --------------------------------------------------------------------------------
function agent_step!(agent, model)
    agent.happy && return
    nearby_same = 0
    for neighbor in nearby_agents(agent, model)
        if agent.group == neighbor.group
            nearby_same += 1
        end
    end

    if nearby_same >= model.min_to_be_happy
        agent.happy = true
    else
        move_agent_single!(agent, model)
    end
    return
end

model = initialize()

fig, _ = abm_plot(model, ac = groupcolor, am = groupmarker)
display(fig)

```

When I type the same code in the Julia REPL I get the following error.

```julia
signal (11): Segmentation fault: 11
in expression starting at REPL[18]:1
_buffer_color_type at /Users/imantha/.julia/packages/PNGFiles/TGHP2/src/io.jl:0
#_load#6 at /Users/imantha/.julia/packages/PNGFiles/TGHP2/src/io.jl:149
_load##kw at /Users/imantha/.julia/packages/PNGFiles/TGHP2/src/io.jl:82 [inlined]
#load#2 at /Users/imantha/.julia/packages/PNGFiles/TGHP2/src/io.jl:29
load at /Users/imantha/.julia/packages/PNGFiles/TGHP2/src/io.jl:23
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_f__call_latest at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
#invokelatest#2 at ./essentials.jl:716 [inlined]
invokelatest at ./essentials.jl:714 [inlined]
#load#3 at /Users/imantha/.julia/packages/ImageIO/vgskl/src/ImageIO.jl:53
load at /Users/imantha/.julia/packages/ImageIO/vgskl/src/ImageIO.jl:53
unknown function (ip: 0x13fe7e78b)
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_f__call_latest at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
#invokelatest#2 at ./essentials.jl:716 [inlined]
invokelatest at ./essentials.jl:714 [inlined]
#action#33 at /Users/imantha/.julia/packages/FileIO/FUXWu/src/loadsave.jl:219
action at /Users/imantha/.julia/packages/FileIO/FUXWu/src/loadsave.jl:197 [inlined]
#action#32 at /Users/imantha/.julia/packages/FileIO/FUXWu/src/loadsave.jl:185
action at /Users/imantha/.julia/packages/FileIO/FUXWu/src/loadsave.jl:185 [inlined]
#load#14 at /Users/imantha/.julia/packages/FileIO/FUXWu/src/loadsave.jl:113
load at /Users/imantha/.julia/packages/FileIO/FUXWu/src/loadsave.jl:110 [inlined]
_broadcast_getindex_evalf at ./broadcast.jl:670 [inlined]
_broadcast_getindex at ./broadcast.jl:643 [inlined]
getindex at ./broadcast.jl:597 [inlined]
copy at ./broadcast.jl:899 [inlined]
materialize at ./broadcast.jl:860 [inlined]
icon at /Users/imantha/.julia/packages/Makie/gQOQF/src/Makie.jl:254
unknown function (ip: 0x13fe7b2b3)
#Screen#48 at /Users/imantha/.julia/packages/GLMakie/pFGSp/src/screen.jl:346
Screen at /Users/imantha/.julia/packages/GLMakie/pFGSp/src/screen.jl:301 [inlined]
global_gl_screen at /Users/imantha/.julia/packages/GLMakie/pFGSp/src/screen.jl:247 [inlined]
global_gl_screen at /Users/imantha/.julia/packages/GLMakie/pFGSp/src/screen.jl:394
global_gl_screen at /Users/imantha/.julia/packages/GLMakie/pFGSp/src/screen.jl:393 [inlined]
backend_display at /Users/imantha/.julia/packages/GLMakie/pFGSp/src/display.jl:2 [inlined]
#display#907 at /Users/imantha/.julia/packages/Makie/gQOQF/src/display.jl:60
display at /Users/imantha/.julia/packages/Makie/gQOQF/src/display.jl:56 [inlined]
#display#906 at /Users/imantha/.julia/packages/Makie/gQOQF/src/display.jl:52 [inlined]
display at /Users/imantha/.julia/packages/Makie/gQOQF/src/display.jl:52
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
do_call at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
eval_body at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_interpret_toplevel_thunk at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_toplevel_eval_flex at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_toplevel_eval_flex at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_toplevel_eval_in at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
eval at ./boot.jl:373 [inlined]
eval_user_input at /Users/administrator/src/julia/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:150
repl_backend_loop at /Users/administrator/src/julia/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:244
start_repl_backend at /Users/administrator/src/julia/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:229
#run_repl#47 at /Users/administrator/src/julia/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:362
run_repl at /Users/administrator/src/julia/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:349
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
#930 at ./client.jl:394
jfptr_YY.930_43775 at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_f__call_latest at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
#invokelatest#2 at ./essentials.jl:716 [inlined]
invokelatest at ./essentials.jl:714 [inlined]
run_main_repl at ./client.jl:379
exec_options at ./client.jl:309
_start at ./client.jl:495
jl_sysimg_fvars_base at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
true_main at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_repl_entrypoint at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
Allocations: 179925494 (Pool: 179887488; Big: 38006); GC: 98

```

---

<div class="post-metadata">

### Author: ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)
#### Post date: [December 14, 2021, 9:11am UTC](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063/2 "2021-12-14T09:11:02Z")

</div>

Try giving [this](https://www.julia-vscode.org/docs/dev/faq/#The-integrated-REPL-closes-when-the-Julia-process-crashes.-How-do-I-get-more-information-on-what's-going-on?) a go to get more info as to what’s crashing your REPL.

---

<div class="post-metadata">

### Author: ![fbanning](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fbanning/32/14972_2.png) [@fbanning](https://discourse.julialang.org/u/fbanning)
#### Post date: [December 14, 2021, 12:18pm UTC](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063/3 "2021-12-14T12:18:35Z")

</div>

It’s hard for me to say anything about this since I neither use an M1 chip nor Julia 1.7. However, you could probably eliminate one of the possible causes by trying to run the same code with the same package versions in a Julia 1.6.4 session.

---

<div class="post-metadata">

### Author: ![wc4wc4wc4](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wc4wc4wc4/32/23038_2.png) [@wc4wc4wc4](https://discourse.julialang.org/u/wc4wc4wc4)
#### Post date: [February 8, 2022, 8:11am UTC](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063/4 "2022-02-08T08:11:21Z")

</div>

@imantha Did you ever figure out what to do about this?  
I have just recently gotten a new M1 Macbook and I run into the same problem.

---

<div class="post-metadata">

### Author: ![fbanning](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fbanning/32/14972_2.png) [@fbanning](https://discourse.julialang.org/u/fbanning)
#### Post date: [February 8, 2022, 4:09pm UTC](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063/5 "2022-02-08T16:09:30Z")

</div>

Did you try it out with a Julia LTS version?

---

<div class="post-metadata">

### Author: ![wc4wc4wc4](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wc4wc4wc4/32/23038_2.png) [@wc4wc4wc4](https://discourse.julialang.org/u/wc4wc4wc4)
#### Post date: [February 8, 2022, 8:12pm UTC](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063/6 "2022-02-08T20:12:25Z")

</div>

Originally I got the following error:

```julia
The terminal process "julia '-i', '--banner=no', '--project=/Users/michelsen/work/diffusion/julia', '/Users/michelsen/.vscode/extensions/julialang.language-julia-1.5.10/scripts/terminalserver/terminalserver.jl', '/var/folders/rt/v4y9l7f92pg7y0jqv03pfn0h0000gn/T/vsc-jl-repl-a8fd5130-7897-45c6-8861-a102f3505ddf', '/var/folders/rt/v4y9l7f92pg7y0jqv03pfn0h0000gn/T/vsc-jl-cr-856fc3db-f484-49ae-8b69-30256cd03ad3', 'USE_REVISE=true', 'USE_PLOTPANE=true', 'USE_PROGRESS=true', 'DEBUG_MODE=false'" terminated with exit code: 139.

```

I then tried v1.6.5 and it worked. Following that, I tried the v1.7.2 x86-version, also without any issues. So now I am using the v1.7.2 x86-version with Rosetta, however, it would be nice to be able to use the native version.

This was happening in VS Code and macOS Montery (12.2) and an M1 Pro.

Let me know if I can be of any help during the debugging!

---

<div class="post-metadata">

### Author: ![met-j](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/met-j/32/21919_2.png) [@met-j](https://discourse.julialang.org/u/met-j)
#### Post date: [February 20, 2022, 12:22pm UTC](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063/7 "2022-02-20T12:22:50Z")

</div>

+1  
I am in the same boat.  
Everything works well in the _real_ REPL.  
But jupyter lab/notebook kernels break as well.

EDIT:  
Of course it is more tricky.  
Some plots seam to work and some do not.  
Functions from `Plots` and `StatsPlots` work, some of my own do not.

---

<div class="post-metadata">

### Author: ![codekomali](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/codekomali/32/34483_2.png) [@codekomali](https://discourse.julialang.org/u/codekomali)
#### Post date: [April 22, 2022, 5:39am UTC](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063/8 "2022-04-22T05:39:35Z")

</div>

+1 same issue.  
I just followed along Makie tutorial  
[https://makie.juliaplots.org/stable/tutorials/basic-tutorial/](https://makie.juliaplots.org/stable/tutorials/basic-tutorial/)  
instead of CairoMakie, I used GLMakie. terminal crashes with the same error  
My system: M1 mac mini  
I switched to Julia 1.7 x86 (Rosetta) following @wc4wc4wc4 advice. Now it works!  
as he said, it would be nice if julia M-Series versions move from experimental to stable.

---

<div class="post-metadata">

### Author: ![lewis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lewis/32/5217_2.png) [@lewis](https://discourse.julialang.org/u/lewis)
#### Post date: [April 25, 2022, 1:45am UTC](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063/9 "2022-04-25T01:45:21Z")

</div>

Me 3. I think that Julia for M1 is a bit experimental and few if any of the maintainers have an M1 Mac so that it is hard to do much testing.

---

<div class="post-metadata">

### Author: ![imantha](https://avatars.discourse-cdn.com/v4/letter/i/6a8cbe/32.png) [@imantha](https://discourse.julialang.org/u/imantha)
#### Post date: [April 26, 2022, 11:36am UTC](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063/10 "2022-04-26T11:36:15Z")

</div>

Sorry for the extremely late reply. Similar to you I got it working on julia 1.7 after installing another version of julia (1.6.5) in my mac. But after some time the same error started repeating itself. So no clue whats going on …

---

<div class="post-metadata">

### Author: ![matic\_lauko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matic_lauko/32/27770_2.png) [@matic\_lauko](https://discourse.julialang.org/u/matic_lauko)
#### Post date: [May 14, 2022, 8:05am UTC](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063/11 "2022-05-14T08:05:00Z")

</div>

I’m using Fedora 36 and get the same error using Julia 1.7.2.  
I have old HP Z1 2012.

---

<div class="post-metadata">

### Author: ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)
#### Post date: [May 14, 2022, 8:15am UTC](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063/12 "2022-05-14T08:15:51Z")

</div>

Can you guys please first clarify if this is an Agents.jl issue, or a Makie.jl issue? I.e., plotting with Makie works fine by itself?

---

<div class="post-metadata">

### Author: ![matic\_lauko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matic_lauko/32/27770_2.png) [@matic\_lauko](https://discourse.julialang.org/u/matic_lauko)
#### Post date: [May 14, 2022, 9:38am UTC](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063/13 "2022-05-14T09:38:11Z")

</div>

I’m getting it with GameZero.jl, but others as far as I udnerstand are getting it on Makie.jl and Agents.jl. Which I think means that it’s a Makie issue, since Agents package is using Makie as far as I know.

---

<div class="post-metadata">

### Author: ![sagarsxn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sagarsxn/32/33826_2.png) [@sagarsxn](https://discourse.julialang.org/u/sagarsxn)
#### Post date: [June 10, 2022, 7:46pm UTC](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063/14 "2022-06-10T19:46:05Z")

</div>

I am running into the same issue with CairoMakie.jl – Julia keep crashing in vscode every time I try to plot

Julia Version 1.7.2  
OS: macOS (arm64-apple-darwin21.2.0)  
CPU: Apple M1 Pro

I am resisting switching to the rosetta version hoping this would get resolved in an update, but might have to make the switch now.

---

<div class="post-metadata">

### Author: ![hpaldan](https://avatars.discourse-cdn.com/v4/letter/h/8c91f0/32.png) [@hpaldan](https://discourse.julialang.org/u/hpaldan)
#### Post date: [June 29, 2022, 11:50am UTC](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063/15 "2022-06-29T11:50:07Z")

</div>

I get the same error when just trying to run plot() with the plots package on VS code. I tried first with v.1.7.3 and then the LTS version 1.6.6 but still the same error. I’m using straight up windows (x86\_64-w64-mingw32).

Anyone know what might be the cause for this?

---

<div class="post-metadata">

### Author: ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)
#### Post date: [June 29, 2022, 11:52am UTC](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063/16 "2022-06-29T11:52:39Z")

</div>

> [@Julia Crashes withTerminal Process Error when excuting plotting functions from Agents.jl pkg](https://discourse.julialang.org/t/julia-crashes-withterminal-process-error-when-excuting-plotting-functions-from-agents-jl-pkg/73063/2):
>
> Try giving [this](https://www.julia-vscode.org/docs/dev/faq/#The-integrated-REPL-closes-when-the-Julia-process-crashes.-How-do-I-get-more-information-on-what's-going-on?) a go to get more info as to what’s crashing your REPL.

> Start a new terminal (integrated or external) and manually start Julia within that terminal. Then use the `Julia: Connect external REPL` command and follow the instructions. After the Julia session is connected to VS Code, run your code as before; the terminal will stay open after Julia closes.
