Environment Setup

Check Python library version

Python library authors put the version number in <module>.__version__

python -c 'import keras; print(keras.__version__)'

install Python package from "requirements.txt"

pip install -r requirements.txt

requirements.txt

requirements.txt

BeautifulSoup
Django==1.3
Fabric==1.2.0
Jinja2==2.5.5
PyYAML==3.09
Pygments==1.4
SQLAlchemy==0.7.1
South==0.7.3
amqplib==0.6.1
anyjson==0.3
...

Anaconda

https://www.anaconda.com/download/

Create Anaconda Virtural Environment

conda create --name tensorflow python=3.5 anaconda

Command

Description

--name tensorflow

Virtual Environment Name is "tensorflow"

python=3.5

Python version is "3.5"

anaconda

Install Python library (e.g. Jupyter Notebook, NumPy ...)

Upgrade pip

python -m pip install --upgrade pip

Uninstall

conda install -c anaconda anaconda-clean
anaconda-clean --yes

存與依據環境檔創建環境

想像在一台電腦以conda建立了一個環境開發某專案,如何讓程式在其他人的電腦上有一樣的環境能重現並開發該專案呢?這時只要使用conda env export > environment.yaml記錄下環境的相關資訊檔environment.yaml,將它放到另一台電腦上然後以conda env create -f environment.yaml載入並建立該環境,如此一來就能在另一台電腦重現了環境並開發該專案了。

  • 儲存環境 conda env export > environment.yaml

  • 依據環境檔創建環境 conda env create -f environment.yaml

conda env export > environment.yaml     # in PC A
conda env create -f environment.yaml    # in PC B

Fixing Jupyter notebook kernel error

python -m ipykernel install --user

or

python -m ipykernel install 

Tensorflow

Installation

pip install --ignore-installed --upgrade tensorflow
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.7.0-py3-none-any.whl

check version

import tensorflow as tf; 
print(tf.__version__)

Keras

Installation

pip install keras

Alternate Installation

conda install -c anaconda theano
conda install -c conda-forge tensorflow 
conda install -c conda-forge keras

Change Keras backend

set "KERAS_BACKEND=tensorflow"
set "KERAS_BACKEND=theano"

C:\Users\Ryan\AppData\Local\conda\conda\envs\tensorflow\etc\conda\activate.d\keras_activate.bat

https://github.com/ContinuumIO/anaconda-issues/issues/1735

https://keras.io/backend/

CUDA on ML machines

Install CUDA on Linux-based ML machines

One Liner Install

Hardware Requirement

如何配置一台适用于深度学习的工作站?

https://www.zhihu.com/question/33996159

Last updated