# Help in using the Cbc solver

**URL:** <https://discourse.julialang.org/t/help-in-using-the-cbc-solver/52956>\
**Category:** Optimization (Mathematical)\
**Tags:** question, package\
**Created:** [January 6, 2021, 6:18pm UTC](https://discourse.julialang.org/t/help-in-using-the-cbc-solver/52956 "2021-01-06T18:18:10Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaquelSantos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raquelsantos/32/3668_2.png) [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Post date:** [January 6, 2021, 6:18pm UTC](https://discourse.julialang.org/t/help-in-using-the-cbc-solver/52956/1 "2021-01-06T18:18:10Z")

</div>

Hi  
Could someone help me in using Cbc. I don’t know what happens but every time I try to compile an error message appears.  
I’m using JuMP v0.18.6 and Cbc v0.7.1, I tried to update these packages but I couldn’t.  
Thank you!

```julia
using JuMP, Cbc, MathOptInterface
m = Model(Cbc.Optimizer)

```

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [January 6, 2021, 8:09pm UTC](https://discourse.julialang.org/t/help-in-using-the-cbc-solver/52956/2 "2021-01-06T20:09:08Z")

</div>

Which is the error message?

---

<div class="post-metadata">

**Author:** ![RaquelSantos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raquelsantos/32/3668_2.png) [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Post date:** [January 6, 2021, 8:27pm UTC](https://discourse.julialang.org/t/help-in-using-the-cbc-solver/52956/3 "2021-01-06T20:27:33Z")

</div>

Hi @Henrique_Becker  
This is the error message that appears to me

```julia
MethodError: no method matching Model(::Type{Cbc.Optimizer})

```

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [January 21, 2021, 8:57pm UTC](https://discourse.julialang.org/t/help-in-using-the-cbc-solver/52956/4 "2021-01-21T20:57:58Z")

</div>

In the topic of updating JuMP, I think it is useful to understand environments.

When you start the REPL and install a package, it goes in your default environment, the one used if you do not select any specific environment.

However, it is useful to have many separate environments for each project of yours, so when you want to run some project you can immediately restore the exact same versions of the same packages used last time and the packages and versions of other projects do not disturb your current project.

So, I would suggest you to do the following.

1. If you do not have a folder for this project of yours create one, and put your code inside.
2. With the terminal/console inside the folder call `julia`.
3. `import Pkg; Pkg.activate(".")` will change your environment from the default to your folder.
4. You can check if you are in a new environment by using `Pkg.status()` it will show no packages installed.
5. Now you can install JuMP with `Pkg.add("JuMP")`. Now two files named `Project.toml` and `Manifest.toml` should have appeared in your folder, are they that save your environment, so do not mess with them unless you know what you are doing.
6. Use `Pkg.status()` to see JuMP installed and check which version was installed, it will probably be the `0.21.5`.
7. Do `Pkg.add("PackageName")` for the next package you need and check `Pkg.status()` after, do it until you have all packages you want in the right version, or some package changes the version of JuMP to an older version. If this happens post the output of the `Pkg.status()` before and after the downgrade here, so we can discover why this package is holding `JuMP` back.

Also, if you close the REPL and open it again, to go back to the environment you were using you need to either do `Pkg.activate(".")` again. Or you can start Julia already in the right environment by using `julia --project=@.`. In both cases your console need to already be inside the folder with the `toml` files, or you need to replace the `.` (the dot) in these commands by the path to the folder with the `toml` files.

---

<div class="post-metadata">

**Author:** ![RaquelSantos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raquelsantos/32/3668_2.png) [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Post date:** [January 22, 2021, 2:54pm UTC](https://discourse.julialang.org/t/help-in-using-the-cbc-solver/52956/5 "2021-01-22T14:54:39Z")

</div>

Hi @Henrique_Becker

When I try to add Julia, the following error message appears:  
`ERROR: KeyError: key "Artifacts" not found`

And even following the step by step, when I managed to install JuMP the old version still appears

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [January 22, 2021, 3:19pm UTC](https://discourse.julialang.org/t/help-in-using-the-cbc-solver/52956/6 "2021-01-22T15:19:27Z")

</div>

If you are using windows can you delete the file:

`C:\Users\<your username>\.julia\registries`

And try following the steps again? (i.e., create a new folder or remove the toml files to start from scratch)

The first `Pkg.add` will probably take a lot more time. Do not worry about this.

Also, what version of Julia are you using, you mentioned JuMP and Cbc versions but not Julia.

---

<div class="post-metadata">

**Author:** ![RaquelSantos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raquelsantos/32/3668_2.png) [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Post date:** [January 22, 2021, 3:23pm UTC](https://discourse.julialang.org/t/help-in-using-the-cbc-solver/52956/7 "2021-01-22T15:23:47Z")

</div>

Ok, I’ll try again  
I’m using JuliaPro v1.5.2-1

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [January 22, 2021, 3:51pm UTC](https://discourse.julialang.org/t/help-in-using-the-cbc-solver/52956/8 "2021-01-22T15:51:46Z")

</div>

Ah, JuliaPro is often a source of problems in this forum. If doing what I suggested do not work then I suggest you avoid using JuliaPro and just use Julia instead (if possible). I heard using Chocolatey to install pure Julia on Windows is straightforward (see [https://chocolatey.org/packages/Julia](https://chocolatey.org/packages/Julia)).

---

<div class="post-metadata">

**Author:** ![RaquelSantos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raquelsantos/32/3668_2.png) [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Post date:** [February 8, 2021, 8:21pm UTC](https://discourse.julialang.org/t/help-in-using-the-cbc-solver/52956/9 "2021-02-08T20:21:09Z")

</div>

Hi @Henrique_Becker  
I followed your advice and downloaded Julia through Chocolatey, but I only managed to download PowerShell.  
Is it possible to download a friendly IDE for Julia through chocolatey?  
Thanks!!!

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [February 8, 2021, 10:18pm UTC](https://discourse.julialang.org/t/help-in-using-the-cbc-solver/52956/10 "2021-02-08T22:18:00Z")

</div>

I have never used one, I edit my files with vim (on Linux) and run Julia through the command line.

I am not sure if there is an IDE already configured, but Chocolatey allows downloading [Visual Studio Code](https://chocolatey.org/packages/vscode) and there are [steps to configure Julia on it](https://www.julia-vscode.org/docs/dev/setup/). Probably there are other options too, but I do not use windows, nor graphical IDEs, since long ago, so I am not the best person to ask about it.

Juno does not seem to be a good option as it comes with JuliaPRO.

---

<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:** [February 9, 2021, 10:27am UTC](https://discourse.julialang.org/t/help-in-using-the-cbc-solver/52956/11 "2021-02-09T10:27:46Z")

</div>

Juno can be used with any Julia version, not just JuliaPro (JuliaPro just bundles Atom/Juno with Julia).
