# VS Code julia environment dosen't match REPL environment

**URL:** https://discourse.julialang.org/t/vs-code-julia-environment-dosent-match-repl-environment/86517
**Category:** General Usage
**Created:** [August 29, 2022, 8:10pm UTC](https://discourse.julialang.org/t/vs-code-julia-environment-dosent-match-repl-environment/86517 "2022-08-29T20:10:58Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![cstook](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstook/32/3731_2.png) [@cstook](https://discourse.julialang.org/u/cstook)
#### Post date: [August 29, 2022, 8:10pm UTC](https://discourse.julialang.org/t/vs-code-julia-environment-dosent-match-repl-environment/86517/1 "2022-08-29T20:10:58Z")

</div>

Should the environment activated in the REPL match the Julia env in the VS Code status bar?

 ![image](https://global.discourse-cdn.com/julialang/original/3X/2/4/244b5e0a61b236aa38fd732fec9202d025ba24fa.png)

---

<div class="post-metadata">

### Author: ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)
#### Post date: [August 29, 2022, 8:28pm UTC](https://discourse.julialang.org/t/vs-code-julia-environment-dosent-match-repl-environment/86517/2 "2022-08-29T20:28:10Z")

</div>

When you start the Julia REPL, yes, it should, but afterwards it is not synced. See:

> <https://github.com/julia-vscode/julia-vscode/issues/1226>
>
> Changing the environment via the Command Palette does not affect the environment… in the integrated REPL, and vice versa. What is the relationship between these two environments? Should they be the same?

---

<div class="post-metadata">

### Author: ![cstook](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstook/32/3731_2.png) [@cstook](https://discourse.julialang.org/u/cstook)
#### Post date: [August 29, 2022, 11:09pm UTC](https://discourse.julialang.org/t/vs-code-julia-environment-dosent-match-repl-environment/86517/3 "2022-08-29T23:09:15Z")

</div>

Which environment is used? The REPL, VS Code, the last change, or do I need to manually change both when I change environments?

---

<div class="post-metadata">

### Author: ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)
#### Post date: [August 30, 2022, 10:36am UTC](https://discourse.julialang.org/t/vs-code-julia-environment-dosent-match-repl-environment/86517/4 "2022-08-30T10:36:35Z")

</div>

Each time you start a new process in VS Code (e.g. start REPL or a notebook, run or debug a file independently of the REPL), the environment marked in the bottom bar is used. If you interact with the integrated REPL (e.g. execute a line or block of code), then of course that will happen in whatever environment is active in the REPL.

---

<div class="post-metadata">

### Author: ![cstook](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstook/32/3731_2.png) [@cstook](https://discourse.julialang.org/u/cstook)
#### Post date: [August 30, 2022, 6:00pm UTC](https://discourse.julialang.org/t/vs-code-julia-environment-dosent-match-repl-environment/86517/5 "2022-08-30T18:00:28Z")

</div>

That makes sense. Thank you.

The reason I asked is I was having a problem with a second environment in a sub-directory in a project, similar to test, but a different sub-directory I created. I thought this might be related to my problem. I never determined why this would not work for me. Moving the sub-directory to its own project fix the problem.

---

<div class="post-metadata">

### Author: ![yha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yha/32/3502_2.png) [@yha](https://discourse.julialang.org/u/yha)
#### Post date: [August 31, 2022, 8:23pm UTC](https://discourse.julialang.org/t/vs-code-julia-environment-dosent-match-repl-environment/86517/6 "2022-08-31T20:23:35Z")

</div>

You can also change environment from the right-click menu on a directory in the VSCode Explorer pane (on the left, ctrl+shift+E to show).  
This also immediately sets it in the REPL, unlike the behavior with the status bar (Not sure if this difference is intentional. It’s a bit odd, but it’s been that way for a long time).

---

<div class="post-metadata">

### Author: ![cstook](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstook/32/3731_2.png) [@cstook](https://discourse.julialang.org/u/cstook)
#### Post date: [August 31, 2022, 8:42pm UTC](https://discourse.julialang.org/t/vs-code-julia-environment-dosent-match-repl-environment/86517/7 "2022-08-31T20:42:27Z")

</div>

I like the right click shortcut. Thanks.

---

<div class="post-metadata">

### Author: ![PyJulia](https://avatars.discourse-cdn.com/v4/letter/p/2acd7d/32.png) [@PyJulia](https://discourse.julialang.org/u/PyJulia)
#### Post date: [September 4, 2024, 7:22am UTC](https://discourse.julialang.org/t/vs-code-julia-environment-dosent-match-repl-environment/86517/8 "2024-09-04T07:22:11Z")

</div>

In case someone tries this and wonders why after restarting the REPL does not use the latest version: I had to completely restart VS Code for the change of environment to properly be applied.
