VS Code julia environment dosen't match REPL environment

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

1 Like

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

1 Like

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

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.

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.

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).

I like the right click shortcut. Thanks.

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.