'Kernel appears to have died on Jupyter notebook, julia 1.7.2

I'm running a julia kernel 1.7.2 in Jupyter notebook on Mac, but when I run the following code I get an error: The kernel appears to have died. It will restart automatically.

I have tried using ] build IJulia but it doesn't work.

This is my code:

Pkg.add("JuMP")
Pkg.add("Cbc")
using JuMP
using Cbc

model = Model(Cbc.Optimizer);
@variable(model, q[1:T] >= 0);
@variable(model, y[1:T] >= 0, Bin);
@variable(model, x[1:T] >= 0);
@objective(model, Min, sum( K*y[t] + h*x[t] for t in 1:T));

@constraint(model,[t = [1]]  , x[t] == x0     + q[t] - d[t]);
@constraint(model,[t = 2:T], x[t] == x[t-1] + q[t] - d[t]);

@constraint(model,[t = 1:T], q[t] <= M*y[t]);

I hope you can help. Thank you in advance.

UPDATE: I tried installing the Cbc in Julia REPL but it doesn't work. I then ran the script in Julia in the terminal on Mac and got the following error:

enter image description here

Do you know how to fix this?

UPDATE: I found out that the problem is that I have a new MacBook with an M1 chip. By installing a version of julia meant for Intel or Rosetta, it now works!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source