程序安装教程

警告
本文最后更新于 2024-01-19,文中内容可能已过时。

一、 apt-get source update

  1. apt-get source change the /etc/apt/sources.list file to aliyun source
  2. add sudo user in rootlink
    1
    
    adduser [name]
    1
    
    apt-get install sudo
    赋予用户sudo权限:
    1
    2
    3
    
    sudo usermod -a -G adm username
    sudo usermod -a -G sudo username
    su [name]
    在文件/etc/sudoers中更改用户的sudo权限:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    # sudoers file.
    #
    # This file MUST be edited with the 'vi sudo' command as root.
    #
    # See the sudoers man page for the details on how to write a sudoers file.
    #
    # Host alias specification
    # User alias specification
    # Cmnd alias specification
    # Defaults specification
    # User privilege specification
    root    ALL=(ALL) ALL
    [username] ALL=(ALL) ALL
    # Uncomment to allow people in group wheel to run all commands
    # %wheel        ALL=(ALL)       ALL
    # Same thing without a password
    # %wheel        ALL=(ALL)       NOPASSWD: ALL
    # Samples
    # %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
    # %users  localhost=/sbin/shutdown -h now

二、 Anaconda or Miniconda Installation

  1. download anaconda or miniconda from tsinghua source website

    download command:

    1
    
    wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.sh

    run the command to install:

    1
    
    bash Miniconda3-latest-linux-x86_64.sh
  2. change the conda channels to tsinghua source

    1
    
    nano ~/.condarc

    paste the following channels into your ~/.condarc file:ref link

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
    #Conda Forge
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
    #msys2(可略)
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
    #bioconda(可略)
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
    #menpo(可略)
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
    #pytorch
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
    # for legacy win-64(可略)
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/peterjc123/
    conda config --set show_channel_urls yes
  3. anaconda 环境文件environment.yml使用参考 创建环境:

    1
    
    conda env create -f environment.yml -n myenv

    导出当前环境配置:

    1
    
    conda env export > environment.yml

    更新环境:

    1
    
    conda env update -f environment.yml

三、 Cmake Installation

Ref Link

  1. Download cmake source file:
    1
    
    wget https://cmake.org/files/v3.20/cmake-3.20.0-linux-x86_64.tar.gz
  2. extract the file and move the file to /opt/cmake-3.20.0
    1
    2
    
    tar zxvf cmake-3.20.0-linux-x86_64.tar.gz
    mv cmake-3.20.0-linux-x86_64 /opt/cmake-3.20.0
  3. link the cmake as system cmake
    1
    
     ln -sf /opt/cmake-3.20.0/bin/*  /usr/bin/
  4. check if successfully installed
    1
    
    cmake --version

四、 Openmpi Installation

Ref Link

  1. Install openmpi with command line:
    1
    
    sudo apt-get install openmpi-bin openmpi-doc libopenmpi-dev
  2. 在conda下安装openmapi:
    1
    
    conda install openmpi

五、 Anaconda下安装jupyter notebook

  1. 安装jupyter notebook

    1
    
    pip install jupyter notebook==6.1.0
  2. 安装nbextensions

    1
    2
    
    pip install jupyter_contrib_nbextensions
    jupyter contrib nbextension install --user

    如果遇到如下报错信息:

    1
    
    ModuleNotFoundError: No module named 'notebook.base'

    注意: 一般由于notebook版本>=7.0.0导致 原因: Notebook的版本太高了,将notebook的版本降到6.1.0

    1
    2
    
    pip install jupyter notebook==6.1.0
    # 或者 pip install --upgrade notebook==6.1.0

    然后再重新安装插件。

  3. 安装nbextensions_configurator

    1
    2
    
    pip install jupyter_nbextensions_configurator
    jupyter nbextensions_configurator enable --user
  4. 启动jupyter Notebook

    1
    
    jupyter notebook

    若如下报错:

    1
    2
    
    ModuleNotFoundError: No module named 'jupyter_server.contents'
    TypeError: warn() missing 1 required keyword-only argument: 'stacklevel'

    则执行以下命令安装traitlets库:

    1
    
    pip install traitlets==5.9.0
  5. codemirror.css文件中更改字体 文件路径: /home/{$USERNAME}/miniconda3/envs/pytorch/lib/python3.8/site-packages/notebook/static/components/codemirror/lib/codemirror.css

  6. 推荐安装的几个jupyter插件:

    • zenmode
    • table of content(2)
    • Autopep8
    • variable inspector
    • ExecuteTime
    • Hide input all 隐藏代码输入
  7. jupyter notebook v7.0 extension installation support: https://github.com/jupyter/notebook/discussions/6881

Buy me a coffee~
支付宝
微信
0%