prepare ml env

I built my new pc last month and walked through the tedious installation process for future machine learning usage.

Here are some reusable snippets just in case I forgot.

My wares

hardware

  • Intel 10900k
  • RTX 2070s Colorful Adoc
  • ASUS Z490 edge wifi version
  • 3600mhz 32G RAM

software

  • win10 professional version
  • efficiency tools
    • listary
    • chrome
      • toby

conda

  • download anaconda
  • invoke anaconda prompt
  • create env
    • conda create --name wow
    • conda create --name wow python=3.7.3
  • list env
    • conda env list
  • activate env
    • conda activate wow
  • list env packages
    • conda list
  • clone an env
    • conda create --name copy --clone wow
  • remove an env
    • conda env remove --name copy

add conda to path

  • in cmd, where conda
  • add three paths to system environment variable PATH
    • 1
    • 2
    • 3

change mirror

find .condarc file under your user folder, replace the content with

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
channels:
- defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

If you need to restore to the default settings, just delete all the lines after show_channel_urls line or you can use conda config --remove-key channels

pip

prepare ml+dl env

install packages

1
2
3
pip install pandas scikit-learn seaborn tqdm
pip install jupyter notebook
pip install jupyter_contrib_nbextensions

the latest tf2 supports both gpu and cpu.

https://pytorch.org

https://www.tensorflow.org/install

install cuda

You should check the pytorch page for cuda version or it can’t detect your gpu properly.

Till now, the latest cuda version you could use is CUDA10.02.

You can find all cuda versions here.

The difference between CUDA and cuDNN:

which cnDNN should you install

just use pip install cudnn and it will automatically choose the right version of cudnn for your cuda version.