JupyterLab kernel に Julia(v1.3.1) を追加

February 8, 2020 – 10:53 am

Jupyterlab の kernelに juliaを追加した。

以下、インストール手順並びに関連情報についてメモしておいた。


CentOS7上にjuliaをインストール
LinuxHelpに示されていたインストール手順に沿ってJuliaをCentOs7上にインストールした。

  • epelリポジトリを最新のものに更新
    # yum update -y --enablerepo=epel epel-release
    
    Updated: 
      epel-release-7-12.noarch
    

     

  • yum-config-manger を使用可能にするため yum-utilをインストール
    # yum install --enablerepo=epel -y yum-utils
    
        Installed: python-kitchen-1.1.1-5.el7.noarch
        Installed: yum-utils-1.1.31-52.el7.noarch
    

     

  • 必要なyum packageをインストール
    # yum-config-manager --add-repo https://copr.fedorainfracloud.org/coprs/nalimilan/julia/repo/epel-7/nalimilan-julia-epel-7.repo
    
        repo saved to /etc/yum.repos.d/nalimilan-julia-epel-7.repo
    

    nalimilan-julia-epel-7.repo:

    [copr:copr.fedorainfracloud.org:nalimilan:julia]
    name=Copr repo for julia owned by nalimilan
    baseurl=https://download.copr.fedorainfracloud.org/results/nalimilan/julia/epel-7-$basearch/
    type=rpm-md
    skip_if_unavailable=True
    gpgcheck=1
    gpgkey=https://download.copr.fedorainfracloud.org/results/nalimilan/julia/pubkey.gpg
    repo_gpgcheck=0
    enabled=1
    enabled_metadata=1
    

     

  • Julia のインストール
    # yum install -y --enablerepo=epel julia
    
         Installed: julia-1.3.1-1.el7.x86_64
         Dependency Installed:
                    mbedtls-2.7.12-1.el7.x86_64   http-parser-2.7.1-8.el7.x86_64
                    libgit2-0.26.6-1.el7.x86_64  openlibm-0.5.3-1.el7.x86_64
                    openblas-threads64_-0.3.3-2.el7.x86_64
                    dSFMT-2.2.3-4.el7.centos.x86_64
                    julia-common-1.3.1-1.el7.noarch               
    

     

  • Julia が正常にインストールされたことを確認
    $ julia
                   _
       _       _ _(_)_     |  Documentation: https://docs.julialang.org
      (_)     | (_) (_)    |
       _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
      | | | | | | |/ _` |  |
      | | |_| | | | (_| |  |  Version 1.3.1 (2019-12-30)
     _/ |\__'_|_|_|\__'_|  |  nalimilan/julia Copr build
    |__/                   |
    
    julia> exit()
    $ which julia
    /usr/bin/julia
    

     

JupyterLabに julia kernelを追加

  • 既存のJupyter kernelの状態を確認しておく
    (trial_env) [tsflow@localhost ~]$ jupyter kernelspec list
    Available kernels:
      ir            /home/tsflow/.local/share/jupyter/kernels/ir
      javascript    /home/tsflow/.local/share/jupyter/kernels/javascript
      python3       /home/tsflow/anaconda3/envs/trial_env/share/jupyter/kernels/python3
    

     

  • IJuliaのインストール
    (trial_env) [tsflow@localhost ~]$ julia
                   _
       _       _ _(_)_     |  Documentation: https://docs.julialang.org
      (_)     | (_) (_)    |
       _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
      | | | | | | |/ _` |  |
      | | |_| | | | (_| |  |  Version 1.3.1 (2019-12-30)
     _/ |\__'_|_|_|\__'_|  |  nalimilan/julia Copr build
    |__/                   |
    
    julia> using Pkg
    
    julia> Pkg.add("IJulia")
       Cloning default registries into `~/.julia`
       Cloning registry from "https://github.com/JuliaRegistries/General.git"
         Added registry `General` to `~/.julia/registries/General`
     Resolving package versions...
     Installed VersionParsing ── v1.2.0
     Installed Conda ─────────── v1.3.0
     Installed IJulia ────────── v1.21.0
     Installed ZeroMQ_jll ────── v4.3.1+0
     Installed Parsers ───────── v0.3.11
     Installed BinaryProvider ── v0.5.8
     Installed ZMQ ───────────── v1.2.0
     Installed MbedTLS ───────── v0.7.0
     Installed JSON ──────────── v0.21.0
     Installed SoftGlobalScope ─ v1.0.10
      Updating `~/.julia/environments/v1.3/Project.toml`
      [7073ff75] + IJulia v1.21.0
      Updating `~/.julia/environments/v1.3/Manifest.toml`
      [b99e7846] + BinaryProvider v0.5.8
      [8f4d0f93] + Conda v1.3.0
      [7073ff75] + IJulia v1.21.0
      [682c06a0] + JSON v0.21.0
      [739be429] + MbedTLS v0.7.0
      [69de0a69] + Parsers v0.3.11
      [b85f4697] + SoftGlobalScope v1.0.10
      [81def892] + VersionParsing v1.2.0
      [c2297ded] + ZMQ v1.2.0
      [8f1865be] + ZeroMQ_jll v4.3.1+0
      [2a0f44e3] + Base64 
      [ade2ca70] + Dates 
      [8ba89e20] + Distributed 
      [7b1f6079] + FileWatching 
      [b77e0a4c] + InteractiveUtils 
      [76f85450] + LibGit2 
      [8f399da3] + Libdl 
      [56ddb016] + Logging 
      [d6f4376e] + Markdown 
      [a63ad114] + Mmap 
      [44cfe95a] + Pkg 
      [de0858da] + Printf 
      [3fa0cd96] + REPL 
      [9a3f8284] + Random 
      [ea8e919c] + SHA 
      [9e88b42a] + Serialization 
      [6462fe0b] + Sockets 
      [8dfed614] + Test 
      [cf7118a7] + UUIDs 
      [4ec0a83e] + Unicode 
      Building Conda ──→ `~/.julia/packages/Conda/kLXeC/deps/build.log`
      Building MbedTLS → `~/.julia/packages/MbedTLS/a1JFn/deps/build.log`
      Building IJulia ─→ `~/.julia/packages/IJulia/fXyGm/deps/build.log`
    

     

  • IJulia の実行に必要なlibrary(を整える
    Centos7では IJuliaを実行(コマンド: using IJulia)しようとすると下記のようなエラーとなり正常にkernelが作れない。因みに、Anaconda には対応するlibraryがあるので正常なので、anacondaのlibraryを借用

    /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found 
    

     
    Anacondaから借用のための作業ログ

    # cp /home/tsflow/anaconda3/lib/libstdc++.so.6.0.26 /usr/lib64
    # rm /usr/lib64/libstdc++.so.6
    # ln -s /usr/lib64/libstdc++.so.6.0.26 /usr/lib64/libstdc++.so.6
    

     

  • Ijulia の実行
    
    julia> using IJulia
    [ Info: Precompiling IJulia [7073ff75-c697-5162-941a-fcdaad2a7d2a]
    
    julia> exit()
    
    

     

  • Jupyter kernels にJuliaが含まれていることを確認
    (trial_env) [tsflow@localhost ~]$ jupyter kernelspec list
    Available kernels:
      ir            /home/tsflow/.local/share/jupyter/kernels/ir
      javascript    /home/tsflow/.local/share/jupyter/kernels/javascript
      julia-1.3     /home/tsflow/.local/share/jupyter/kernels/julia-1.3
      python3       /home/tsflow/anaconda3/envs/trial_env/share/jupyter/kernels/python3
    

     

JupyterLab lancher snapshot:
Julia kernel 追加後のJupyterLab lancherのスナップショットをアップしておいた。


(画像クリックで実寸大で拡大)
 

参考にしたサイト・資料


Post a Comment