I’ve been using Julia for six years. I moved to it from Python, but one thing I absolutely cannot do is install packages. So today when I saw a graph in Wolfram Alpha that didn’t look right (eventually I found the root issue seems to be that Wolfram Alpha thinks arcsin(sin(x)/2)) is equal to sin(x)/2) I decided I’d install a graphing calculator program on my computer…except why should I do that when I have Julia?! because I can’t install Plots.
So today is the day I suck it up and ask.
Accord to Plots, you install it with Pkg.add("Plots") which results in
Pkg.add(“Plots”)
ERROR: UndefVarError: Pkg not defined
Stacktrace:
[1] top-level scope at REPL[2]:1
The Julia documentation says to enter the package manager with “]” (okay so far) and enter “add Plots”. That last part failed with “ERROR: no active project” except it most certainly is an active project.
You could try following the steps in that post (touching ~/.julia/environments/v1.4/Project.toml and ~/.julia/environments/v1.4/Manifest.toml` ) or you could try using the generic linux binaries from Download Julia .
Using the generic linux binaries has consistently been the best approach in my experience, although I’m not on Arch so I can’t speak to that specifically.
I use Julia in Arch Linux. I never had any problems, but I do not use the distribution package, I download the tarball from the site, extract to /opt and make a link sudo ln -s /opt/julia-1.4.2/bin/julia /usr/bin/julia.
First, this error means you have not brought Pkg into namespace or define it. If it is a module, using Pkg brings it to the current module. Second, normal users usually do not have enough privilege to write under /opt folder.
Sorry, I should have been more specific. I do have permission (I’m the owner) and I was trying pkg> status. And by that I don’t mean I typed pkg> but rather that is the prompt I get when in the package manager.
No need to be sorry. I cleary understood you have used package manager REPL at the end but I’ve just refered to the programmatical way of using it that you’ve tried at first. For the other issue, have you tried ]up to get list of pakages?
(@v1.4) pkg> help activate
activate
activate [--shared] path
Activate the environment at the given path, or the home project environment if no path is specified. The active environment is
the environment that is modified by executing package commands. When the option --shared is given, path will be assumed to be a
directory name and searched for in the environments folders of the depots in the depot stack. In case no such environment exists
in any of the depots, it will be placed in the first depot of the stack.
(@v1.4) pkg> activate
Activating environment at `/home/lutfullah/Programs/homedir/.julia/environments/v1.4/Project.toml`