forked from zuoxingdong/lagom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
2_install_miniconda.sh
executable file
·51 lines (42 loc) · 1.98 KB
/
2_install_miniconda.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
##################################
# Install Miniconda & create env #
# Date: 2018-12-09 #
# Author: Xingdong Zuo #
##################################
# Stop when some intermediate command is failed
set -e
# Create list of variables
export MINICONDA=Miniconda3-latest-Linux-x86_64.sh # Check new version
export ENV_NAME=lagom # name of conda environment
export PYTHON_VERSION=3.7 # Python version
# Download and install Miniconda
wget https://repo.anaconda.com/miniconda/$MINICONDA
bash $MINICONDA -b # batch mode, auto agree license and not touch .bashrc
hash -r
rm $MINICONDA
# Temporarily enable conda command
. $HOME/miniconda3/etc/profile.d/conda.sh
# Update to latest version
conda update -q -y conda
conda update -y --all
conda info -a
# Create and activate an environment with latest Python and useful packages: MKL-optimizations (also numpy/scipy etc.) within Anaconda
conda create -q -y -n $ENV_NAME python=$PYTHON_VERSION mkl mkl-include cmake cython cffi typing patchelf msgpack-python setuptools wheel twine cloudpickle pyyaml ipython numpy scipy pandas scikit-image scikit-learn seaborn matplotlib pillow imageio sphinx sphinx_rtd_theme
conda activate $ENV_NAME
# Append environment variables to .bashrc
echo "# Appended by Miniconda installer" >> ~/.bashrc
echo "export LIBRARY_PATH=\$LIBRARY_PATH:$HOME/miniconda3/envs/$ENV_NAME/lib" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:$HOME/miniconda3/envs/$ENV_NAME/lib" >> ~/.bashrc
echo "export PKG_CONFIG_PATH=\$PKG_CONFIG_PATH:$HOME/miniconda3/envs/$ENV_NAME/lib/pkgconfig/" >> ~/.bashrc
echo ". $HOME/miniconda3/etc/profile.d/conda.sh" >> ~/.bashrc # Load conda command
echo "conda activate $ENV_NAME" >> ~/.bashrc # auto-load environment
echo "" >> ~/.bashrc
echo "#######################"
echo "# Verify installation #"
echo "#######################"
conda list
echo "##########################"
echo "# Installation finished #"
echo "# Restart a new terminal #"
echo "##########################"