sagemathinc / cocalc-docker

DEPRECATED (was -- Docker setup for running CoCalc as downloadable software on your own computer)
https://cocalc.com
Other
398 stars 103 forks source link

adding Julia packages in a project fails with "permission denied" #162

Closed szazs89 closed 1 year ago

szazs89 commented 1 year ago

I have recently updated the docker image (ID:039bb42cee78, 2022-07-06), and tried to add some packages (SymPy, Plots) to it, but it fails with no permission. After docker exec -it cocalc bash, I could add those packages (as root), but now from a regular project I get:

(@v1.6) pkg> st
      Status `/opt/julia/local/share/julia/environments/v1.6/Project.toml`
  [3e1990a7] Hecke v0.14.7
  [7073ff75] IJulia v1.23.3
  [2edaba10] Nemo v0.31.1
→ [91a5bcdd] Plots v1.25.9
  [c3e4b0f8] Pluto v0.19.9
→ [d330b81b] PyPlot v2.10.0
→ [24249f21] SymPy v1.1.6
        Info packages marked with → not downloaded, use `instantiate` to download
(@v1.6) pkg> instantiate
ERROR: IOError: stat("/opt/julia/local/share/julia/registries/General/Registry.toml"): permission denied (EACCES)
Stacktrace:
[...]

The same happens when trying Pkg.instantiate() from an .ipynb.

I don't know why it searches the path /opt/julia/local/... and not ~/.julia/....

Is it a bug or I have missed sg.?

szazs89 commented 1 year ago

If I remove/rename the folder /opt/julia/local then julia discards to search it, and tries to use ~/.julia. (I.e. each project has to setup it correctly -- e.g. from a terminal julia > Pkg.add("IJulia"), etc. -- if they need julia. That's how I had used it before the new image was installed.)

szazs89 commented 1 year ago

The way to add and use globally installed packages:

docker exec -it cocalc bash
# now we are root
umask 0022
JULIA_DEPOT_PATH=/opt/julia/local/share/julia julia
pkg> add PyCall SymPy
pkg> precompile
pkg> build
pkg> add LaTeXStrings Printf Plots PyPlot #etc.
pkg> st
pkg> update #etc.

Now, in a user termina of a cocalc sessionl run julia and check the packages:

pkg> st

If something is not OK, try to remove .julia directory. (Basically, it should contain a log directory, only.)

williamstein commented 1 year ago

Thanks!

williamstein commented 1 year ago

It would be good to add instructions like this somewere in the docs https://github.com/sagemathinc/cocalc-docker/tree/master/docs e.g., about how to add packages for each language.