ML environment construction with Miniconda

Preface

As a memorandum, the procedure for building a machine learning environment with Miniconda is summarized.

environment

OS: macOS Big Sur Terminal: MacBook Air (13-inch, Early 2015) (* It may be time to buy a new PC ... *)

Miniconda installation

Download the Miniconda installer from here. Start a terminal and execute the following command. (Assumed to be in the Downloads folder)

input


cd Downloads 
sh Miniconda3-latest-MacOSX-x86_64.sh 

When executed, the following text will be displayed.

Display [Welcome to Miniconda]


Welcome to Miniconda3 py38_4.9.2 
… 
Please, press ENTER to continue

Enter the Enter key. (A long consent form will be displayed after this. If you do not read or understand, press the Space key repeatedly)

Display [License, do you agree? ]


Do you accept the license terms? [yes|no]
[no] >>>

If you do not agree, you will not be able to proceed, so enter `` `yes```.

Display [Where to install? ]


Miniconda3 will now be installed into this location:
/Users/------/miniconda3

If you are not particular about the installation location, just press the Enter key.

Display [How to start? ]


Do you wish the installer to initialize Miniconda3
by running conda init? [yes|no]
[yes] >>> 

When you start the terminal, you will be asked if you want to start Conda, so enter `yes`. (The method to change the setting later is described in here.)

This completes the Miniconda installation. If you want to uninstall it, click here (#minicondaのアンインストール).

Environment construction / activation

Next, build an environment for machine learning.

First, add one repository to look for with `conda install`. (Because some packages cannot be installed with the default settings)

input


 conda config --append channels conda-forge

Next, use the following command to build your own machine learning environment.

input


conda create -n NAME python=X.X.X 

Input [* In my case *]


conda create -n mlenvs python=3.7 numpy pandas matplotlib scikit-learn jupyter tqdm seaborn umap-learn

When you enter the above command, the following contents will be displayed.

Display [Continue? ]


Collecting package metadata (current_repodata.json): done
Solving environment: done
...
Proceed ([y]/n)? 

Enter `` `y``` to continue.

Activate the environment you built earlier with the following command.

input


conda activate NAME

Input [* In my case *]


conda activate mlenvs

Now you have built and enabled the environment! Please send us a fun machine learning life! !! (Enter conda deactivate to exit the virtual environment.)

bonus

Change how to start Miniconda

Start a terminal and execute the following command.

Start automatically


conda config --set auto_activate_base true

Does not start automatically


conda config --set auto_activate_base false

Uninstall Miniconda

Start a terminal and execute the following command.

input


rm -rf ~/miniconda3/ ~/.conda/

Then remove the following from ``` ~/.zshrc (or ~/.bash_profile)` ``.

~/.zshrc


# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/------/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/------/miniconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/------/miniconda3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/------/miniconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

This completes the uninstallation of Miniconda.

Recommended Posts

ML environment construction with Miniconda
Get started with Python! ~ ① Environment construction ~
ruby environment construction with aws EC2
Easy Jupyter environment construction with Cloud9
Automate environment construction with Shell Script
Python3 environment construction with pyenv-virtualenv (CentOS 7.3)
Using Chainer with CentOS7 [Environment construction]
pytorch @ python3.8 environment construction with pipenv
Data science environment construction with Docker
Environment construction with pyenv and pyenv-virtualenv
Django environment construction
[Ubuntu 18.04] Python environment construction with pyenv + pipenv
DeepIE3D environment construction
Emacs-based environment construction
Linux environment construction
Python environment construction
Vue.js + Flask environment construction memorandum ~ with Anaconda3 ~
Environment construction (python)
django environment construction
CodeIgniter environment construction
python environment construction
Python --Environment construction
Python environment construction
A memo packed with RADEX environment construction
Golang environment construction
python environment construction
Let's get along with Python # 0 (Environment construction)
Word2vec environment construction
Collecting information from Twitter with Python (Environment construction)
Environment construction with VSCode + Remote Container (Go / Application)
MacOS 10.11 environment construction: Powerline with Anaconda and Dein.vim
[0] TensorFlow-GPU environment construction built with Anaconda on Ubuntu
Poetry-virtualenv environment construction with python of centos-sclo-rh ~ Notes
A memo when creating a python environment with miniconda
First python ① Environment construction with pythonbrew & Hello World !!
From Python environment construction to virtual environment construction with anaconda
Environment construction: GCP + Docker
Django project environment construction
python windows environment construction
Go language environment construction
ConoHa environment construction memo
homebrew python environment construction
PyData related environment construction
Anaconda-4.2.0-python3 environment construction (Mac)
Python development environment construction
YOLO v4 environment construction ①
Python environment with docker-compose
pyenv + fish environment construction
python2.7 development environment construction
BigGorilla environment construction memo
grip environment construction onCentOS6.5
Anaconda environment construction memo
Golang environment construction [goenv]
Mac environment construction Python
Pyxel environment construction (Mac)
Virtual environment with Python 3.6
Python environment construction @ Win7
Virtual environment construction with Docker + Flask (Python) + Jupyter notebook
[Python] OpenCV environment construction with Docker (cv2.imshow () also works)
Data analysis environment construction with Python (IPython notebook + Pandas)
Web application made with Python3.4 + Django (Part.1 Environment construction)