Install package of Julia in Cocalc

Hi community,
Do anyone have a suggested instruction for doing so?
My attempts are listed as below. As there is no existent manual for installing package of Julia in Cocalc, I attempted to read an equivalent for R.

" The install command will not work unless you upgrade your project to have internet access."
With internet access (checked in my Cocalc project setting) I should be able to install package directly, but:


It doesn’t work. The I tried the " download the tarball of the R package to your own machine, and upload it to your project. Then, you can tell R to install the package directly from there as a local file."
But for Julia I get stuck in the second step.

Either start with

using Pkg
Pkg.add("Plots")
...

or
type ] than you see:
(v1.3) pkg>
and there use
(v1.3) pkg> add Plots

2 Likes

Thx this worked but with new error.

The failed attempts of change the read-only file to write-access are listed.


git clone


By ‘gksqt’ I googled=> saying need to update GR

while this error remains questioned (Pkg: GtkTextUtils in manifest but not in project).

To summarize, Plots.jl file appeared in my Cocalc project (done by git clone) but cannot be used in Julia.

Hi, on CoCalc, there is a global setup with a couple of pre-installed julia packages. There is a depot environment variable set for this:

echo $JULIA_DEPOT_PATH 
/home/user/.julia:/ext/julia/depot/

However, your attempts try to change something there. You can specify to create your own “project” in your home directory, where you have read-write access. I.e. try to do this:

export JULIA_PROJECT=/home/user/.julia/environment/v1.3

and then start julia, etc.

Beyond that, I don’t know how to deal with this. Maybe someone here has a good idea how to support global package installs and still provide a way to install packages in your home dir. Btw: the above JULIA_PROJECT variable is also set automatically when you run the julia 1.3 kernel in a jupyter notebook.

Thank you. I did as instructed, but the error still is using the former read-only file to install package). Is there any way to change the pathway/file for installing packages? There are some basic packages like Plots not included in the pre-installed package TAT.

Did you install package matplotlib?
sudo apt install python3-matplotlib


Thank you. The problem could be that the file is read-only.

I sometimes also have problems installing packages on our cluster (not CoCalc) even though my default environment is at my home folder. Not sure what is your problem exactly, but for me usually it works to install the packages in a project specific environment (which is anyway good practice).
Maybe try something like this in the REPL:

(v1.3) pkg> activate /home/user/my_project

(my_project) pkg> add PackageName

Do you have permission to the /ext directory? Usually packages are installed in the /home/user/.julia… directory.

This nailed it. Thank you!


only plot cannot be supported in Cocalc.

I can view it (list of pre-installed package) but not the administrator.

Did you do using Plots before trying the plot command?

Yes included. The screenshot is just for showing the output.