As a memorandum, the procedure for building a machine learning environment with Miniconda is summarized.
OS: macOS Big Sur Terminal: MacBook Air (13-inch, Early 2015) (* It may be time to buy a new PC ... *)
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のアンインストール).
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.)
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
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