# CairoMakie with Julia 1.8 on VScode

**URL:** <https://discourse.julialang.org/t/cairomakie-with-julia-1-8-on-vscode/86289>\
**Category:** VS Code\
**Tags:** plotting\
**Created:** [August 24, 2022, 8:22pm UTC](https://discourse.julialang.org/t/cairomakie-with-julia-1-8-on-vscode/86289 "2022-08-24T20:22:27Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![ptoche](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ptoche/32/23554_2.png) [@ptoche](https://discourse.julialang.org/u/ptoche)\
**Post date:** [September 29, 2022, 9:15pm UTC](https://discourse.julialang.org/t/cairomakie-with-julia-1-8-on-vscode/86289/21 "2022-09-29T21:15:08Z")

</div>

I’m not sure if I understand the subtleties of your question, but what I do is every time I want to change the environment from within VScode, I go to preferences → Settings and change the Path. If you don’t need to do that too often, it’s fine.

---

<div class="post-metadata">

**Author:** ![wsshin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wsshin/32/360_2.png) [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Post date:** [October 1, 2022, 11:03am UTC](https://discourse.julialang.org/t/cairomakie-with-julia-1-8-on-vscode/86289/22 "2022-10-01T11:03:46Z")

</div>

Thanks @ptoche. To elaborate for other people, I went to Settings \> Extensions \> Julia \> Environment Path, and clicked “Workspace” in the red box in the attached screenshot.

 ![Screen Shot 2022-10-01 at 06.56.34](https://global.discourse-cdn.com/julialang/original/3X/c/e/ce1586504f76481ea95f0a910b738caf335e2a7a.png)  
Then I clicked “Edit in settings.json”, and changed

```json
{
    "julia.environmentPath": ""
}

```

to

```json
{
    "julia.environmentPath": "<MY HOME DIRECTORY>/.julia/environments/v1.8"
}

```

This makes VScode REPL to start in the home environment.

---

<div class="post-metadata">

**Author:** ![benz0li](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/benz0li/32/37040_2.png) [@benz0li](https://discourse.julialang.org/u/benz0li)\
**Post date:** [October 3, 2022, 1:19pm UTC](https://discourse.julialang.org/t/cairomakie-with-julia-1-8-on-vscode/86289/23 "2022-10-03T13:19:49Z")

</div>

I have the following `~/.julia/config/startup.jl` in place, which also works when using the command line interface (CLI) or Jupyter Notebooks:

```julia
println("Executing user-specific startup file (", @ __FILE__ , ")...")

try
    using Revise
    println("Revise started")
catch e
    @warn "Error initializing Revise" exception=(e, catch_backtrace())
end

using Pkg
if isfile(joinpath(pwd(), "Project.toml")) && isfile(joinpath(pwd(), "Manifest.toml"))
    Pkg.activate(pwd())
else
    Pkg.activate("$(ENV["HOME"])/.julia/environments/v$(VERSION.major).$(VERSION.minor)")
end
println(" → Overrides the environment set by the VS Code Julia extension!")

```

---

<div class="post-metadata">

**Author:** ![benz0li](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/benz0li/32/37040_2.png) [@benz0li](https://discourse.julialang.org/u/benz0li)\
**Post date:** [June 4, 2023, 6:38am UTC](https://discourse.julialang.org/t/cairomakie-with-julia-1-8-on-vscode/86289/24 "2023-06-04T06:38:14Z")

</div>

My current _startup files_ for Julia 1.9; which work identically both in Terminal and with VS Code.

Cross reference: [Starting REPL (v1.9) within a project does not recognise packages installed at system level · Issue #3304 · julia-vscode/julia-vscode · GitHub](https://github.com/julia-vscode/julia-vscode/issues/3304)

* * *

_$JULIA\_PATH/etc/julia/startup.jl_

```julia
# This file contains site-specific commands to be executed on Julia startup;
# Users may store their own personal commands in `~/.julia/config/startup.jl`.

println("Executing site-specific startup file (", @ __FILE__ , ")...")

push!(LOAD_PATH, joinpath("$(ENV["JULIA_PATH"])", "local", "share", "julia",
        "environments", "v$(VERSION.major).$(VERSION.minor)"))

using Pkg

```

* * *

_$HOME/.julia/config/startup.jl_

```julia
println("Executing user-specific startup file (", @ __FILE__ , ")...")

# https://github.com/julia-vscode/julia-vscode/issues/3304
project = (Base.JLOptions().project != C_NULL ?
    unsafe_string(Base.JLOptions().project) :
    get(ENV, "JULIA_PROJECT", nothing))
if !isnothing(project)
    Pkg.activate(; io=devnull)
end

try
    using Revise
    println("Revise started")
catch e
    @warn "Error initializing Revise" exception=(e, catch_backtrace())
end

if !isnothing(project) &&
    # https://github.com/julia-vscode/julia-vscode/issues/3304
    !startswith(Base.load_path_expand(Base.LOAD_PATH[end]), project)

    if startswith(project, "@")
        if startswith(project, "@.")
            if isnothing(Base.current_project())
                Pkg.activate(joinpath("$(ENV["HOME"])", ".julia",
                        "environments", "v$(VERSION.major).$(VERSION.minor)"))
            else
                Pkg.activate(Base.current_project(); io=devnull)
            end
        else
            Pkg.activate(Base.load_path_expand(project); io=devnull)
        end
    else
        Pkg.activate(abspath(expanduser(project)); io=devnull)
    end
else
    if isfile(joinpath(pwd(), "Project.toml")) &&
        isfile(joinpath(pwd(), "Manifest.toml"))

        Pkg.activate(pwd())
    else
        Pkg.activate(joinpath("$(ENV["HOME"])", ".julia", "environments",
                "v$(VERSION.major).$(VERSION.minor)"))
    end
end

```

ℹ `JULIA_PATH=/usr/local/julia`

[Previous page](https://discourse.julialang.org/t/cairomakie-with-julia-1-8-on-vscode/86289.md?page=1)
