Julia: Start REPL

Why does this happen after you’ve selected the python interpreter from a conda env?

Julia> C:/ProgramData/anaconda3/Scripts/activate
ERROR: syntax: "/" is not a unary operator
Stacktrace:
 [1] top-level scope
   @ none:1

julia> conda activate juliaenv
ERROR: syntax: extra token "activate" after end of expression
Stacktrace:
 [1] top-level scope
   @ none:1

julia> 

The terminal properly activates the env but why does the activate script try to run from the julia REPL?

VSCode Info:
Version: 1.81.1 (user setup)
Commit: 6c3e3dba23e8fadc360aed75ce363ba185c49794
Date: 2023-08-09T22:22:42.175Z
Electron: 22.3.18
ElectronBuildId: 22689846
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.19044

That doesn’t belong at the REPL (default) prompt:

julia> conda activate juliaenv
ERROR: syntax: extra token "activate" after end of expression

Julia doesn’t use conda, or anaconda, so this doesn’t apply in any of its prompts. Julia has its own package manager, and Pkg prompt for it. You can use Julia without (conda or those) other package managers, that’s the default. Depending on what you want to do, you can use conda with PythonCall.jl (or directly with CondaPkg.jl), but not in that way, nor that exact command.

C:/ProgramData/anaconda3/Scripts/activate is just a path to a file, and doesn’t belong in Julia’s, or any REPL, even Python’s. It’s very likely you want to run it, then from the shell, or what you would call command-line, console in Windows. And I guess the same for your conda command.

I do understand that these are not julia commands - my question is when you start the Julia REPL from within VSCode (after having selected a specific conda environment), why do these activation commands get sent to the REPL at all?

3 Likes