Machine Learning Software Setup
Python
Install Python 2.7 from scratch, so that we don't have to worry about lxplus-speific python versions/configuration/environment.
This takes some time, but gives us a stable environment to work in. It will be located in ~/.localpython.
export MY_ML_DIR=$HOME/ML
mkdir -p $MY_ML_DIR/python
cd $MY_ML_DIR/python
wget http://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
tar -zxvf Python-2.7.9.tgz
cd Python-2.7.9
mkdir ~/.localpython
./configure --prefix=$HOME/.localpython
make
make install
Make virtual environment so that we work in a clean, self contained python setup:
cd $MY_ML_DIR/python
wget https://pypi.python.org/packages/5c/79/5dae7494b9f5ed061cff9a8ab8d6e1f02db352f3facf907d9eb614fb80e9/virtualenv-15.0.2.tar.gz#md5=0ed59863994daf1292827ffdbba80a63
tar -zxvf virtualenv-15.0.2.tar.gz
cd virtualenv-15.0.2/
~/.localpython/bin/python setup.py install
virtualenv ve -p $HOME/.localpython/bin/python2.7
source ve/bin/activate
# Initialize virtual Python environment
virtualenv py_virtualenv
# This activates the environment! Has to be run after each login
source py_virtualenv/bin/activate
# ML and ML-related libraries (you may not need all of these)
pip install theano
pip install keras=="1.2.0"
pip install h5py
pip install pypng
pip install sklearn
Upon first using Keras, it may complain that
TensorFlow is not installed. In which case you need to either install
TensorFlow, or configure Keras to use Theano by modifying ~/.keras/keras.json to read
{
"epsilon": 1e-07,
"floatx": "float32",
"image_data_format": "channels_last",
"backend": "theano"
}
Resources
https://indico.cern.ch/event/595059/contributions/2522193/attachments/1430921/2197986/slides_iml_keras_workshop.pdf
https://root.cern.ch/doc/v608/dir_050d74ad7a64b0aa8b3fbebce21e7998.html
Topic revision: r2 - 2017-05-19
- unknown