If I want to enter the Package environment and I run:
]
on the main GUI of Atom installed by JuliaPro I get this error:
syntax: unexpected "]"
If I run it on the REPL it works well.
I I run it on VS Code it also works.
If I want to enter the Package environment and I run:
]
on the main GUI of Atom installed by JuliaPro I get this error:
syntax: unexpected "]"
If I run it on the REPL it works well.
I I run it on VS Code it also works.
Are you writing it in a script?
yes I am.
That doesn’t work. You can use the pkg"..."
custom string or Pkg
API commands.
I wanted tio follow StatsMakie.jl instructions:
] add AbstractPlotting#master Makie#master https://github.com/JuliaPlots/StatsMakie.jl.git
That tutorial was written with REPL in mind. But you make a good point that maybe tutorials should defer to using Pkg
.
I’m lazy, so I have made script files for adding packages and updating packages… because of that, I use Pkg
. I sync these script files across several computers using OneDrive. Thus I have a script file for adding packages, addPackages.jl
which I run using include("addPackages.jl")
… looking somewhat like:
using Pkg
Pkg.add("Plots")
Pkg.add("DifferentialEquations")
Pkg.add("LaTeXStrings")
…
Because of this, I prefer Pkg
over ]
… I also have an updatePackages.jl
script something like:
using Pkg
Pkg.update()
using Plots
using DifferentialEquations
…
Here, my hope is that the using Plots
etc. compiles/checks the packages so that they start faster when I actually use them… I typically rund these scripts overnight.
Maybe my procedure is naïve – perhaps there is no gain in the using Plots
, etc. – but at least, I can test whether the packages work. The only problem I have with this is that it seems like if one of the addings/usings fail, then the script appears to stop/skip the subsequent statements.
Would this be better: 4. Working with Environments · Pkg.jl?
Also, Pkg.add
accepts a list of names (e.g. Pkg.add(["Plots", "LaTeXStrings", ...]
)
] works well on VS Code.
but it wont work in any other script you write. if you are trying to make anything that will run on anything other than vs code, you should use Pkg
.
I highly recommend you read the documentation. All of your questions can be answered by searching through the documentation.
There is something to be said for other interactive environments emulating the REPL to some extent. That’s why IJulia recognizes inputs starting with ?
or ]
.