【Linux】 Minicondaをインストールする手順

この記事では,Anacondaの軽量版であるMinicondaをLinuxにインストールする手順を記載します.

目次

AnacondaとMinicondaの違い

AnacondaとMinicondaはどちらもPythonのディストリビューションです.

AnacondaはPythonとそのデータサイエンス関連ツールを内包しています.科学技術計算を始めるためには非常に便利ですが,その結果,インストール時にかなりのディスクスペースを必要とします.

一方,MinicondaはPythonとcondaパッケージ管理システムのみを提供します.それ以外のパッケージは必要に応じて個別にインストールします.

したがって,MinicondaはAnacondaの軽量版です.

ある程度Python周りのパッケージに慣れた方はMinicondaのほうがおすすめです.

インストール手順

Minicondaの公式ページは下記URLです.

https://docs.conda.io/en/latest/miniconda.html#linux-installers

ここではMinicondaの最新版をインストールする手順を解説します.

Linuxの最新版をダウンロード

次のコマンドでMinicondaの最新版のインストーラーをダウンロードします.


wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

インストール

インストーラーであるスクリプトを実行します.

ライセンスの同意などが求められるため,適宜”yes”と入力します.


bash Miniconda3-latest-Linux-x86_64.sh

Welcome to Miniconda3 py311_23.5.2-0

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>
Anaconda has self-classified this software as Export Commodity Control Number (ECCN) EAR99, which includes mass market information security software using or performing cryptographic functions with asymmetr
ic algorithms. No license is required for export of this software to non-embargoed countries.

The Intel Math Kernel Library contained in Miniconda is classified by Intel as ECCN 5D992.c with no license required for export to non-embargoed countries.

The following packages listed on https://www.anaconda.com/cryptography are included in the Repository accessible through Miniconda that relate to cryptography.

Last updated March 21, 2022


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

Miniconda3 will now be installed into this location:
/root/miniconda3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/root/miniconda3] >>> /opt/miniconda3

...

Preparing transaction: done
Executing transaction: done
installation finished.
Do you wish the installer to initialize Miniconda3
by running conda init? [yes|no]
[no] >>> yes

デフォルトのインストール先は${HOME}/miniconda3/です.変更したい場合は,インストール先を指定します.

“yes”を入力していくとインストールが完了します.


...
Thank you for installing Miniconda3!

上記のメッセージを確認したのちに,端末を開きなおすと設定が反映されています.

確認

下記コマンドでバージョンを確認します.無事バージョンが表示されればインストールは成功しています.


conda --version
conda 23.5.2

使い方

次のコマンドで,Python 3.10.9で特定の名前(test)の仮想環境を作成します.


conda create --name test python=3.10.9

作成した仮想環境は次のコマンドで確認できます.


conda info -e
# conda environments:
#
base                  *  /root/miniconda3
test                     /root/miniconda3/envs/test

仮想環境をアクティベートするには,次のコマンドです.


conda activate test

まとめ

この記事では,Anacondaの軽量版であるMinicondaのインストール方法を示しました.

Condaの環境では,Pythonのバージョンを指定して仮想環境を作成できるため非常に便利です.

よかったらシェアしてね!
目次