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

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 :

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

The ligne that provokes this error is something like that:

@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 ?

This is a known issue in the recent JuMP 0.21 release (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.

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

add JuMP@0.20.1

It seems to be installed successfully:

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.

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:

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