Changes between Version 1 and Version 2 of misc/setup_for_ML_build-python


Ignore:
Timestamp:
05/11/23 15:26:03 (12 months ago)
Author:
obina
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • misc/setup_for_ML_build-python

    v1 v2  
    1 = 機械学習環境を個人用PCにセットアップする = 
     1= 機械学習環境を個人用PCにセットアップする: Pythonソースビルド版 = 
    22[[PageOutline]] 
    33 
    4 加速器機械学習フォーラムでの話題がきっかけで書きました。 
    5 初心者向けの環境構築の一例として活用いただけますと幸いです。 
    6  
    7  
    8 このセットアップ手順はWindowsPCで簡単に環境を構築する例となっていますが、WSL2を除けばUbuntu環境や多くのLinux環境でそのまま使えるはずです。その場合はpython3のところから読んでください。 
    9  
     4こちらの記事 
     5 
     6https://cerldev.kek.jp/trac/EpicsUsersJP/wiki/misc/setup_for_ML 
     7 
     8との差は、python3.11をソースからビルドすることです。 
    109 
    1110概略 
     
    2019 
    2120== WSL2のインストール == 
    22 最初に__管理者権限で__コマンドプロンプトを開く。wslコマンドで、インストール可能なディストリビューションを検索・確認する。 
    23 (wslコマンドが無い場合は、適当にGoogleで検索してください) 
    24 {{{ 
    25 C:\>wsl --list --online 
    26 インストールできる有効なディストリビューションの一覧を次に示します。 
    27 'wsl --install -d <Distro>' を使用してインストールします。 
    28  
    29 NAME                                   FRIENDLY NAME 
    30 Ubuntu                                 Ubuntu 
    31 Debian                                 Debian GNU/Linux 
    32 kali-linux                             Kali Linux Rolling 
    33 Ubuntu-18.04                           Ubuntu 18.04 LTS 
    34 Ubuntu-20.04                           Ubuntu 20.04 LTS 
    35 Ubuntu-22.04                           Ubuntu 22.04 LTS 
    36 OracleLinux_7_9                        Oracle Linux 7.9 
    37 OracleLinux_8_7                        Oracle Linux 8.7 
    38 OracleLinux_9_1                        Oracle Linux 9.1 
    39 SUSE-Linux-Enterprise-Server-15-SP4    SUSE Linux Enterprise Server 15 SP4 
    40 openSUSE-Leap-15.4                     openSUSE Leap 15.4 
    41 openSUSE-Tumbleweed                    openSUSE Tumbleweed 
    42 }}} 
    43  
    44 [[Image(wsl_install1.png, 40%)]] 
    45  
    46  
    47 ここではUbuntu22.04をインストールすることにする。 
    48 {{{ 
    49 C:\>wsl --install --d Ubuntu-22.04 
    50 インストール中: Ubuntu 22.04 LTS 
    51 Ubuntu 22.04 LTS はインストールされました。 
    52 Ubuntu 22.04 LTS を起動しています... 
    53 }}} 
    54  
    55 自動的にUbuntuのターミナルが起動して、ユーザー名を入れるプロンプトが出るので、ユーザー名とパスワードを設定する。 
    56 (最初は少し時間がかかるかもしれない) 
    57 {{{ 
    58 Installing, this may take a few minutes... 
    59 Please create a default UNIX user account. The username does not need to match your Windows username. 
    60 For more information visit: https://aka.ms/wslusers 
    61 Enter new UNIX username: obina 
    62 New password: 
    63 Retype new password: 
    64 passwd: password updated successfully 
    65 Installation successful! 
    66 To run a command as administrator (user "root"), use "sudo <command>". 
    67 See "man sudo_root" for details. 
    68  
    69 Welcome to Ubuntu 22.04.2 LTS (GNU/Linux 5.10.60.1-microsoft-standard-WSL2 x86_64) 
    70  
    71  * Documentation:  https://help.ubuntu.com 
    72  * Management:     https://landscape.canonical.com 
    73  * Support:        https://ubuntu.com/advantage 
    74  
    75 This message is shown once a day. To disable it please create the 
    76 /home/obina/.hushlogin file. 
    77 obina@notepc:~$ 
    78 }}} 
    79 [[Image(wsl_install2.png, 40%)]] 
    80  
    81 [[Image(wsl_install3.png, 40%)]] 
    82  
    83  
    84  
    85 いちおう確認 
    86 {{{ 
    87 obina@notepc:~$ cat /etc/os-release 
    88 PRETTY_NAME="Ubuntu 22.04.2 LTS" 
    89 NAME="Ubuntu" 
    90 VERSION_ID="22.04" 
    91 VERSION="22.04.2 LTS (Jammy Jellyfish)" 
    92 VERSION_CODENAME=jammy 
    93 ID=ubuntu 
    94 ID_LIKE=debian 
    95 HOME_URL="https://www.ubuntu.com/" 
    96 SUPPORT_URL="https://help.ubuntu.com/" 
    97 BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" 
    98 PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" 
    99 UBUNTU_CODENAME=jammy 
    100 obina@notepc:~$ uname -a 
    101 Linux notepc 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux 
    102 }}} 
    103  
    104 パッケージのアップデート。先ほど入力したパスワードを入れる 
    105 {{{ 
    106 obina@notepc:~$ sudo apt update 
    107 Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease 
    108 Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB] 
    109 ..... 
    110 Fetched 26.5 MB in 6s (4327 kB/s) 
    111 Reading package lists... Done 
    112 Building dependency tree... Done 
    113 Reading state information... Done 
    114 19 packages can be upgraded. Run 'apt list --upgradable' to see them. 
    115 }}} 
    116  
    117 {{{ 
    118 obina@notepc:~$ sudo apt upgrade 
    119 Reading package lists... Done 
    120 Building dependency tree... Done 
    121 Reading state information... Done 
    122 Calculating upgrade... Done 
    123 The following packages will be upgraded: 
    124   apt apt-utils distro-info-data git git-man libapt-pkg6.0 libglib2.0-0 libglib2.0-bin libglib2.0-data libssl3 libxml2 
    125   openssl tzdata ubuntu-advantage-tools vim vim-common vim-runtime vim-tiny xxd 
    126 19 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 
    127 10 standard LTS security updates 
    128 Need to get 21.9 MB of archives. 
    129 After this operation, 348 kB of additional disk space will be used. 
    130 Do you want to continue? [Y/n] Y 
    131 .... 
    132 obina@notepc:~$  
    133 }}} 
    134  
    135 とりあえずここまでで十分。 
    136  
     21こちらを参照: https://cerldev.kek.jp/trac/EpicsUsersJP/wiki/misc/setup_for_ML#WSL2%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB 
    13722 
    13823== python3インストール == 
     
    447332}}} 
    448333 
    449 参考のため、pip list 確認(pip freeze 結果ファイルはこちら) 
    450 {{{ 
    451 (tf2.12) obina@notepc:~$ pip list 
    452 Package                      Version 
    453 ---------------------------- -------- 
    454 absl-py                      1.4.0 
    455 anyio                        3.6.2 
    456 argon2-cffi                  21.3.0 
    457 argon2-cffi-bindings         21.2.0 
    458 arrow                        1.2.3 
    459 asttokens                    2.2.1 
    460 astunparse                   1.6.3 
    461 attrs                        23.1.0 
    462 backcall                     0.2.0 
    463 beautifulsoup4               4.12.2 
    464 bleach                       6.0.0 
    465 cachetools                   5.3.0 
    466 certifi                      2023.5.7 
    467 cffi                         1.15.1 
    468 charset-normalizer           3.1.0 
    469 comm                         0.1.3 
    470 contourpy                    1.0.7 
    471 cycler                       0.11.0 
    472 debugpy                      1.6.7 
    473 decorator                    5.1.1 
    474 defusedxml                   0.7.1 
    475 executing                    1.2.0 
    476 fastjsonschema               2.16.3 
    477 flatbuffers                  23.3.3 
    478 fonttools                    4.39.3 
    479 fqdn                         1.5.1 
    480 gast                         0.4.0 
    481 google-auth                  2.17.3 
    482 google-auth-oauthlib         1.0.0 
    483 google-pasta                 0.2.0 
    484 grpcio                       1.54.0 
    485 h5py                         3.8.0 
    486 idna                         3.4 
    487 ipykernel                    6.23.0 
    488 ipython                      8.13.2 
    489 ipython-genutils             0.2.0 
    490 isoduration                  20.11.0 
    491 jax                          0.4.8 
    492 jedi                         0.18.2 
    493 Jinja2                       3.1.2 
    494 jsonpointer                  2.3 
    495 jsonschema                   4.17.3 
    496 jupyter_client               8.2.0 
    497 jupyter_core                 5.3.0 
    498 jupyter-events               0.6.3 
    499 jupyter_server               2.5.0 
    500 jupyter_server_terminals     0.4.4 
    501 jupyterlab-pygments          0.2.2 
    502 keras                        2.12.0 
    503 kiwisolver                   1.4.4 
    504 libclang                     16.0.0 
    505 Markdown                     3.4.3 
    506 MarkupSafe                   2.1.2 
    507 matplotlib                   3.7.1 
    508 matplotlib-inline            0.1.6 
    509 mistune                      2.0.5 
    510 ml-dtypes                    0.1.0 
    511 nbclassic                    1.0.0 
    512 nbclient                     0.7.4 
    513 nbconvert                    7.4.0 
    514 nbformat                     5.8.0 
    515 nest-asyncio                 1.5.6 
    516 notebook                     6.5.4 
    517 notebook_shim                0.2.3 
    518 numpy                        1.23.5 
    519 oauthlib                     3.2.2 
    520 opt-einsum                   3.3.0 
    521 packaging                    23.1 
    522 pandocfilters                1.5.0 
    523 parso                        0.8.3 
    524 pexpect                      4.8.0 
    525 pickleshare                  0.7.5 
    526 Pillow                       9.5.0 
    527 pip                          23.1.2 
    528 platformdirs                 3.5.0 
    529 prometheus-client            0.16.0 
    530 prompt-toolkit               3.0.38 
    531 protobuf                     4.23.0 
    532 psutil                       5.9.5 
    533 ptyprocess                   0.7.0 
    534 pure-eval                    0.2.2 
    535 pyasn1                       0.5.0 
    536 pyasn1-modules               0.3.0 
    537 pycparser                    2.21 
    538 Pygments                     2.15.1 
    539 pyparsing                    3.0.9 
    540 pyrsistent                   0.19.3 
    541 python-dateutil              2.8.2 
    542 python-json-logger           2.0.7 
    543 PyYAML                       6.0 
    544 pyzmq                        25.0.2 
    545 requests                     2.30.0 
    546 requests-oauthlib            1.3.1 
    547 rfc3339-validator            0.1.4 
    548 rfc3986-validator            0.1.1 
    549 rsa                          4.9 
    550 scipy                        1.10.1 
    551 Send2Trash                   1.8.2 
    552 setuptools                   65.5.0 
    553 six                          1.16.0 
    554 sniffio                      1.3.0 
    555 soupsieve                    2.4.1 
    556 stack-data                   0.6.2 
    557 tensorboard                  2.12.3 
    558 tensorboard-data-server      0.7.0 
    559 tensorflow                   2.12.0 
    560 tensorflow-estimator         2.12.0 
    561 tensorflow-io-gcs-filesystem 0.32.0 
    562 termcolor                    2.3.0 
    563 terminado                    0.17.1 
    564 tinycss2                     1.2.1 
    565 tornado                      6.3.1 
    566 traitlets                    5.9.0 
    567 typing_extensions            4.5.0 
    568 uri-template                 1.2.0 
    569 urllib3                      2.0.2 
    570 wcwidth                      0.2.6 
    571 webcolors                    1.13 
    572 webencodings                 0.5.1 
    573 websocket-client             1.5.1 
    574 Werkzeug                     2.3.4 
    575 wheel                        0.40.0 
    576 wrapt                        1.14.1 
    577 }}} 
    578  
    579334再掲:venv環境を抜けるのはdeactivate コマンドで終了するか、システムから抜ける。 
    580335 
     
    587342 
    588343[[Image(wsl_python_torch1.png, 40%)]] 
    589  
    590344 
    591345ここではGPUが無い環境なので