# Declaration of variable JuMP works well on ATOM but does not work on VSCODE

**URL:** <https://discourse.julialang.org/t/declaration-of-variable-jump-works-well-on-atom-but-does-not-work-on-vscode/35058>\
**Category:** Optimization (Mathematical)\
**Tags:** vscode\
**Created:** [February 24, 2020, 12:07am UTC](https://discourse.julialang.org/t/declaration-of-variable-jump-works-well-on-atom-but-does-not-work-on-vscode/35058 "2020-02-24T00:07:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayce\_ram](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jayce_ram/32/3977_2.png) [@jayce\_ram](https://discourse.julialang.org/u/jayce_ram)\
**Post date:** [February 24, 2020, 12:07am UTC](https://discourse.julialang.org/t/declaration-of-variable-jump-works-well-on-atom-but-does-not-work-on-vscode/35058/1 "2020-02-24T00:07:33Z")

</div>

I have been working in a huge optimization problem and I have tried to execute my script on VSCode to see if I could improve the simulation time.

I have installed VSCode (OS Debian) and I simply have executed the same script that works well in ATOM (OS Windows) and I got the following error :

```julia
ERROR: LoadError: MethodError: no method matching JuMP.Containers.SparseAxisArray(::Dict{Any,Any})

```

The ligne that provokes this error is something like that:

```julia
@variable(model, var_ximp[r in regions,c in commodities[r], y in years]>=0)

```

the dictionary commodities can be empty in some cases and I imagine the problem might be related with that.  
Anyone knows why this problem is present on VSCode ? Or this problem is related to LINUX system? How we can deal with it ?

---

<div class="post-metadata">

**Author:** ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Post date:** [February 24, 2020, 1:48am UTC](https://discourse.julialang.org/t/declaration-of-variable-jump-works-well-on-atom-but-does-not-work-on-vscode/35058/2 "2020-02-24T01:48:31Z")

</div>

This is a known issue in the recent JuMP 0.21 release ([Creating empty SparseAxisArray not possible · Issue #2169 · jump-dev/JuMP.jl · GitHub](https://github.com/JuliaOpt/JuMP.jl/issues/2169)) and likely has nothing to do with VSCode. The easiest workaround is to downgrade to JuMP 0.20.1 temporarily.

---

<div class="post-metadata">

**Author:** ![jayce\_ram](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jayce_ram/32/3977_2.png) [@jayce\_ram](https://discourse.julialang.org/u/jayce_ram)\
**Post date:** [February 25, 2020, 5:47am UTC](https://discourse.julialang.org/t/declaration-of-variable-jump-works-well-on-atom-but-does-not-work-on-vscode/35058/3 "2020-02-25T05:47:14Z")

</div>

I got an old version of JuMP by using the command:

```julia
add JuMP@0.20.1

```

It seems to be installed successfully:

```julia
v1.3) pkg> add JuMP@0.20.1
 Resolving package versions...
 Installed Tables ────── v1.0.2
 Installed Observables ─ v0.3.0
 Installed HTTP ──────── v0.8.9
 Installed WebIO ─────── v0.8.11
 Installed JuMP ──────── v0.20.1
  Updating `~/.julia/environments/v1.3/Project.toml`
  [4076af6c] ↓ JuMP v0.21.0 ⇒ v0.20.1
  Updating `~/.julia/environments/v1.3/Manifest.toml`
  [cd3eb016] ↑ HTTP v0.8.8 ⇒ v0.8.9
  [4076af6c] ↓ JuMP v0.21.0 ⇒ v0.20.1
  [510215fc] ↑ Observables v0.2.3 ⇒ v0.3.0
  [bd369af6] ↑ Tables v1.0.1 ⇒ v1.0.2
  [0f1e0344] ↓ WebIO v0.8.13 ⇒ v0.8.11
  Building WebIO → `~/.julia/packages/WebIO/2mZPb/deps/build.log`

```

But I still got the same error.

```julia
ERROR: LoadError: MethodError: no method matching JuMP.Containers.SparseAxisArray(::Dict{Any,Any})

```

It’s necessary to do something else ?

#update  
To use an old version of a package, the steps described in the post below have worked well for me:

> [@How to pin a package to previous version on Julia 1.0?](https://discourse.julialang.org/t/how-to-pin-a-package-to-previous-version-on-julia-1-0/13661/6):
>
> The uuid refers to the package, not the version. If you want to pin a specific version, use add to obtain it, then pin to pin it. (v0.7) pkg\> add Blink [...] (v0.7) pkg\> st Status `~/.julia/environments/v0.7/Project.toml` [ad839575] Blink v0.7.0 (v0.7) pkg\> add Blink@0.6.2 Resolving package versions... Updating `~/.julia/environments/v0.7/Project.toml` [ad839575] ↓ Blink v0.7.0 ⇒ v0.6.2 Updating `~/.julia/environments/v0.7/Manifest.toml` [ad839575] ↓ Blink v0.7.0 ⇒ v0.6.2 [...]…

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [February 25, 2020, 3:05pm UTC](https://discourse.julialang.org/t/declaration-of-variable-jump-works-well-on-atom-but-does-not-work-on-vscode/35058/4 "2020-02-25T15:05:16Z")

</div>

You need to exit VSCode and re-start Julia for the new package to take effect.
