gpt4 book ai didi

server - 在 Julia 上全局安装一个包

转载 作者:行者123 更新时间:2023-12-04 17:46:38 25 4
gpt4 key购买 nike

我在一台机器上安装了一个新的 Julia,我想将它用作实验室中各种人员的数字处理服务器。似乎有一个叫做 jupyterhub 的好包,它使 Jupyter Notebook 界面同时可供各种客户端使用。我无法再次找到的网页开始建议诸如“首先全局安装 IJulia,然后安装 JupyterHub...”

我似乎找不到一种在全局安装 ONE 软件包的好方法。

最佳答案

更新

在 Julia-v0.7+ 中,我们需要使用 JULIA_DEPOT_PATH而不是 JULIA_PKGDIRLOAD_PATH看起来像这样:

julia> LOAD_PATH
3-element Array{Any,1}:
Base.CurrentEnv()
Any[Base.NamedEnv("v0.7.0"), Base.NamedEnv("v0.7"), Base.NamedEnv("v0"), Base.NamedEnv("default"), Base.NamedEnv("v0.7", create=true)]
"/Users/gnimuc/Codes/julia/usr/share/julia/stdlib/v0.7"

旧帖

"first install IJulia globally, then install JupyterHub..."



不知道是不是真的,按照下面的步骤,你就可以安装 IJulia安装后 Jupyterhub .

为每个用户在系统范围/全局安装软件包

这个问题已经回答了 here斯蒂芬·卡尔平斯基 (Stefan Karpinski)所以我们需要的只是用这个方法安装 IJulia.jl包裹。

There's a Julia variable called LOAD_PATH that is arranged to point at two system directories under your julia installation. E.g.:


julia> LOAD_PATH
2-element Array{Union(ASCIIString,UTF8String),1}:
"/opt/julia-0.3.3/usr/local/share/julia/site/v0.3"
"/opt/julia-0.3.3/usr/share/julia/site/v0.3"

If you install packages under either of those directories, then everyone using that Julia will see them. One way to do this is to run julia as a user who can write to those directories after doing export JULIA_PKGDIR=/opt/julia-0.3.3/usr/share/julia/site in the shell. That way Julia will use that as it's package directory and normal package commands will allow you to install packages for everyone....



让 IJulia 与 Jupyterhub 一起工作

为了使 IJuliaJupyterhub为所有用户相互协作,您应该复制文件夹 your/user/.local/share/jupyter/kernels/julia//usr/local/share/jupyter/kernels/ .我写下我在测试中使用的一些步骤 Dockerfile .代码很丑,但它有效。

步骤:(成功安装Jupyterhub后)

请注意,您应该以 root 身份执行以下步骤,我假设您的 julia 已全局安装在 /opt/julia_0.4.0/ .
  • 创建我们的全局包目录并设置 JULIA_PKGDIR :
    mkdir /opt/global-packages
    echo 'push!(LOAD_PATH, "/opt/global-packages/.julia/v0.4/")' >> /opt/julia_0.4.0/etc/julia/juliarc.jl
    export JULIA_PKGDIR=/opt/global-packages/.julia/
  • 使用包管理器安装“IJulia”:
    julia -e 'Pkg.init()'
    julia -e 'Pkg.add("IJulia")'
  • 复制 kernelspec转至 /usr/local/share/jupyter/kernels/ Jupyterhub 添加的任何新用户都可以使用它:
    jupyter kernelspec list
    cd /usr/local/share/ && mkdir -p jupyter/kernels/
    cp -r /home/your-user-name/.local/share/jupyter/kernels/julia-0.4-your-julia-version /usr/local/share/jupyter/kernels/
  • 关于server - 在 Julia 上全局安装一个包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32338701/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com