Pythonのパッケージ管理ツールとしてPip,Conda,Mambaなどがあります。
今日はcondaコマンドを使えるようにしようと思います。
condaについて
Anacondaを使っている方は馴染みのコマンドだと思いますが、Anacondaが特定の規模の法人や営利利用だと有償化したのでPipを使うようになった方も多いかも知れません。
Anaconda reserves the right to discontinue or alter any or all of the Repository. To avoid confusion, “commercial activities” are any use of the Repository which is NOT:
use solely by an individual using for personal, non-business purposes,
use by a student or employee of an educational institution in connection with educational activities,
use by an employee or volunteer on behalf of a non-profit institution in connection with the provision of charitable services,
use by a 501(c)(3) non-profit research institution in connection with non-commercial activities, such as research to address societal needs and global challenges, public policy development, or the advancement of science for the general good, where such work will not result in revenue to the institution, or use by entities in common control with each other with fewer than 200 employees in aggregate.
引用: https://legal.anaconda.com/policies/en/?name=terms-of-service (as of 22/11/19)
ただし私も勘違いしていたのですが、condaコマンド自体はオープンソースのBSDライセンスのツールなので無料で使えるようです。
Conda is an open source package management system and environment management system
引用: https://docs.conda.io/en/latest/Conda is released under the 3-clause BSD license with the following terms:
引用: https://docs.conda.io/en/latest/license.html
condaはチャンネルと言われるレポジトリからPythonのパッケージをインストールするようですが、Anaconda社が管理しているDefaultチャンネルを利用する場合、法人の規模によってはライセンス料を支払う必要があるようです。ただし、コミュニティ管理であるconda-forgeというチャンネルは法人も無償で使うことが出来るようです。
By default, packages are automatically downloaded and updated from the default channel https://repo.anaconda.com/pkgs/ which may require a paid license, as described in the repository terms of service a commercial license. The conda-forge channel is free for all to use.
引用: https://docs.conda.io/projects/conda/en/latest/user-guide/concepts/channels.html
図にすると下記になります。「青」は有償で利用しないといけない場合があるが、「赤」に関しては無料で使えるということのようです。

AnacondaとMinicondaとは
ではAnacondaやMinicondaとは何なのでしょうか?
The fastest way to obtain conda is to install Miniconda, a mini version of Anaconda that includes only conda and its dependencies. If you prefer to have conda plus over 7,500 open-source packages, install Anaconda.
引用: https://conda.io/projects/conda/en/stable/user-guide/install/index.htmlMiniconda is a free minimal installer for conda. It is a small, bootstrap version of Anaconda that includes only conda, Python, the packages they depend on, and a small number of other useful packages, including pip, zlib and a few others
引用: https://docs.conda.io/en/latest/miniconda.htmlAnaconda and Miniconda are distributions. A software distribution is a collection of packages, pre-built and pre-configured, that can be installed and used on a system.
引用: https://stackoverflow.com/questions/45421163/anaconda-vs-miniconda
調べてみましたが、どうやらAnacondaもMinicondaもディストリビューションと呼び、色々事前にPythonで分析など出来るように設定してくれたものをインストールできるツールのようです。
Anacondaはcondaと一緒に7500種類以上のパッケージやライブラリをインストールしてくれるもので、Minicondaはcondaとその他数種類の最低限必要なパッケージやライブラリをインストールしてくれるもののようです。
どちらをインストールしても良さそうですが、両方とも初期設定でdefaultチャンネルを使いパッケージをインストールするため、Anaconda社のいう商業活動(commercial activities)に当てはまる場合はライセンスを購入するかconda-forgeチャンネルを利用する必要があるということになります。
法人で無料利用したい場合はconda+conda-forgeチャンネルを使う
個人やプライベート利用の場合は気にしなくても良いのですが、Anaconda社の定義する商用利用に当てはまる場合はライセンス購入するか下記の方法で無償でcondaを使うようにします。
- Minicondaをインストールし、チャンネルのデフォルトをconda-forgeに変更する
- 最初からconda-forgeをデフォルトチャンネルに設定してくれるMiniforgeを利用する
どうせなので両方試してみたいと思います。
Minicondaをインストールしデフォルトチャンネルをconda-forgeに変更する
Minicondaのインストーラーをダウンロードしインスールする
インストーラーの一覧はこちらからダウンロードできます。今回はMacにインストールします。
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O ~/miniconda.sh
--2022-11-19 20:38:32-- https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh repo.anaconda.com (repo.anaconda.com) をDNSに問いあわせています... 2606:4700::6810:8203, 2606:4700::6810:8303, 104.16.131.3, ... repo.anaconda.com (repo.anaconda.com)|2606:4700::6810:8203|:443 に接続しています... 接続しました。 HTTP による接続要求を送信しました、応答を待っています... 200 OK 長さ: 58693864 (56M) [application/x-sh] `/Users/hinomaruc/miniconda.sh' に保存中 /Users/hinomaruc/miniconda.sh 100%[=======================================================>] 55.97M 18.3MB/s 時間 3.1s 2022-11-19 20:38:35 (18.3 MB/s) - `/Users/hinomaruc/miniconda.sh' へ保存完了 [58693864/58693864]
bash ~/miniconda.sh -b -p $HOME/miniconda
PREFIX=/Users/hinomaruc/miniconda
Unpacking payload ...
Collecting package metadata (current_repodata.json): done
Solving environment: done
environment location: /Users/hinomaruc/miniconda
added / updated specs:
- brotlipy==0.7.0=py39h9ed2024_1003
- ca-certificates==2022.3.29=hecd8cb5_1
- certifi==2021.10.8=py39hecd8cb5_2
- cffi==1.15.0=py39hc55c11b_1
- charset-normalizer==2.0.4=pyhd3eb1b0_0
- colorama==0.4.4=pyhd3eb1b0_0
- conda-content-trust==0.1.1=pyhd3eb1b0_0
- conda-package-handling==1.8.1=py39hca72f7f_0
- conda==4.12.0=py39hecd8cb5_0
- cryptography==36.0.0=py39hf6deb26_0
- idna==3.3=pyhd3eb1b0_0
- libcxx==12.0.0=h2f01273_0
- libffi==3.3=hb1e8313_2
- ncurses==6.3=hca72f7f_2
- openssl==1.1.1n=hca72f7f_0
- pip==21.2.4=py39hecd8cb5_0
- pycosat==0.6.3=py39h9ed2024_0
- pycparser==2.21=pyhd3eb1b0_0
- pyopenssl==22.0.0=pyhd3eb1b0_0
- pysocks==1.7.1=py39hecd8cb5_0
- python.app==3=py39hca72f7f_0
- python==3.9.12=hdfd78df_0
- readline==8.1.2=hca72f7f_1
- requests==2.27.1=pyhd3eb1b0_0
- ruamel_yaml==0.15.100=py39h9ed2024_0
- setuptools==61.2.0=py39hecd8cb5_0
- six==1.16.0=pyhd3eb1b0_1
- sqlite==3.38.2=h707629a_0
- tk==8.6.11=h7bc2e8c_0
- tqdm==4.63.0=pyhd3eb1b0_0
- tzdata==2022a=hda174b7_0
- urllib3==1.26.8=pyhd3eb1b0_0
- wheel==0.37.1=pyhd3eb1b0_0
- xz==5.2.5=h1de35cc_0
- yaml==0.2.5=haf1e3a3_0
- zlib==1.2.12=h4dc903c_1
The following NEW packages will be INSTALLED:
brotlipy pkgs/main/osx-64::brotlipy-0.7.0-py39h9ed2024_1003
ca-certificates pkgs/main/osx-64::ca-certificates-2022.3.29-hecd8cb5_1
certifi pkgs/main/osx-64::certifi-2021.10.8-py39hecd8cb5_2
cffi pkgs/main/osx-64::cffi-1.15.0-py39hc55c11b_1
charset-normalizer pkgs/main/noarch::charset-normalizer-2.0.4-pyhd3eb1b0_0
colorama pkgs/main/noarch::colorama-0.4.4-pyhd3eb1b0_0
conda pkgs/main/osx-64::conda-4.12.0-py39hecd8cb5_0
conda-content-tru~ pkgs/main/noarch::conda-content-trust-0.1.1-pyhd3eb1b0_0
conda-package-han~ pkgs/main/osx-64::conda-package-handling-1.8.1-py39hca72f7f_0
cryptography pkgs/main/osx-64::cryptography-36.0.0-py39hf6deb26_0
idna pkgs/main/noarch::idna-3.3-pyhd3eb1b0_0
libcxx pkgs/main/osx-64::libcxx-12.0.0-h2f01273_0
libffi pkgs/main/osx-64::libffi-3.3-hb1e8313_2
ncurses pkgs/main/osx-64::ncurses-6.3-hca72f7f_2
openssl pkgs/main/osx-64::openssl-1.1.1n-hca72f7f_0
pip pkgs/main/osx-64::pip-21.2.4-py39hecd8cb5_0
pycosat pkgs/main/osx-64::pycosat-0.6.3-py39h9ed2024_0
pycparser pkgs/main/noarch::pycparser-2.21-pyhd3eb1b0_0
pyopenssl pkgs/main/noarch::pyopenssl-22.0.0-pyhd3eb1b0_0
pysocks pkgs/main/osx-64::pysocks-1.7.1-py39hecd8cb5_0
python pkgs/main/osx-64::python-3.9.12-hdfd78df_0
python.app pkgs/main/osx-64::python.app-3-py39hca72f7f_0
readline pkgs/main/osx-64::readline-8.1.2-hca72f7f_1
requests pkgs/main/noarch::requests-2.27.1-pyhd3eb1b0_0
ruamel_yaml pkgs/main/osx-64::ruamel_yaml-0.15.100-py39h9ed2024_0
setuptools pkgs/main/osx-64::setuptools-61.2.0-py39hecd8cb5_0
six pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_1
sqlite pkgs/main/osx-64::sqlite-3.38.2-h707629a_0
tk pkgs/main/osx-64::tk-8.6.11-h7bc2e8c_0
tqdm pkgs/main/noarch::tqdm-4.63.0-pyhd3eb1b0_0
tzdata pkgs/main/noarch::tzdata-2022a-hda174b7_0
urllib3 pkgs/main/noarch::urllib3-1.26.8-pyhd3eb1b0_0
wheel pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0
xz pkgs/main/osx-64::xz-5.2.5-h1de35cc_0
yaml pkgs/main/osx-64::yaml-0.2.5-haf1e3a3_0
zlib pkgs/main/osx-64::zlib-1.2.12-h4dc903c_1
Preparing transaction: done
Executing transaction: \
done
installation finished.
インストールが完了しました。3分もかかっていないと思います。condaはパッケージだけではなく、Python環境の管理もしてくれるのでpython-3.9.12もインストールしてくれるようです。
condaが参照しているチャンネルの確認
source ~/miniconda/bin/activate
そうすると、ターミナルの先頭に (base) という文字が表示されるようになります。
(base) hinomaruc@myMBP ~ %
PATHを通すなどはconda initやconda init zsh (MacOS Catalina以降)を実行すれば.bash_profileに記載などしてくれるようですが、私は都度PATHを指定するかマニュアルでやることにします。
ちなみに参考程度ですが、conda initを実行すると.bash_profileに下記設定が書き込まれました。
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/hinomaruc/miniconda/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/hinomaruc/miniconda/etc/profile.d/conda.sh" ]; then
. "/Users/hinomaruc/miniconda/etc/profile.d/conda.sh"
else
export PATH="/Users/hinomaruc/miniconda/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
(base) hinomaruc@myMBP miniconda % conda info
・・・一部省略・・・
active environment : base
active env location : /Users/hinomaruc/miniconda
conda version : 4.12.0
python version : 3.9.12.final.0
base environment : /Users/hinomaruc/miniconda (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/osx-64
https://repo.anaconda.com/pkgs/r/noarch
・・・一部省略・・・
チャンネルは https://repo.anaconda.com を利用しているので、Anaconda社管理のレポジトリを参照してしまっているようです。
こちらを消去し、conda-forgeを参照するように変更します。
(base) hinomaruc@myMBP ~ % conda config --show channels
channels: - defaults
(base) hinomaruc@myMBP ~ % conda config --show custom_multichannels
custom_multichannels:
defaults:
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
local:
# チャンネルも表示する
(base) hinomaruc@myMBP ~ % conda list -c
defaults/osx-64::brotlipy-0.7.0-py39h9ed2024_1003 defaults/osx-64::ca-certificates-2022.3.29-hecd8cb5_1 defaults/osx-64::certifi-2021.10.8-py39hecd8cb5_2 defaults/osx-64::cffi-1.15.0-py39hc55c11b_1 defaults/noarch::charset-normalizer-2.0.4-pyhd3eb1b0_0 defaults/noarch::colorama-0.4.4-pyhd3eb1b0_0 defaults/osx-64::conda-4.12.0-py39hecd8cb5_0 ・・・省略・・・
defaultsチャンネルのパッケージがインストールされているようです。
defaultsチャンネルの消去とconda-forgeの追加
(base) hinomaruc@myMBP ~ % conda config --remove channels defaults
(base) hinomaruc@myMBP ~ % conda config --show channels
channels: []
チャンネルがなくなりました。
# 参考: https://conda-forge.org/
(base) hinomaruc@myMBP ~ % conda config --add channels conda-forge
(base) hinomaruc@myMBP ~ % conda config --set channel_priority strict
(base) hinomaruc@myMBP ~ % conda config --show channels
channels: - conda-forge
conda-forgeが登録されました。
しかし、インストールされているパッケージはdefaultsチャンネルのものなので、conda-forgeのものに変更してあげる必要があります。
個々のパッケージやライブラリをconda install -c conda-forge --override-channels xxx のようにconda-forgeチャンネル指定で上書きしてあげてもよいですが、conda update condaでMinicodaをアップデートしてあげることでconda-forgeのパッケージにまとめてアップデートすることが出来るのでおすすめです。
# 参考: https://conda.io/projects/conda/en/stable/user-guide/install/macos.html#updating-anaconda-or-miniconda
(base) hinomaruc@myMBP ~ % conda update conda
Collecting package metadata (current_repodata.json): done
Solving environment: done
・・・省略・・・
The following packages will be downloaded:
package | build
---------------------------|-----------------
brotlipy-0.7.0 |py39ha30fb19_1005 368 KB conda-forge
bzip2-1.0.8 | h0d85af4_4 155 KB conda-forge
ca-certificates-2022.9.24 | h033912b_0 150 KB conda-forge
certifi-2022.9.24 | pyhd8ed1ab_0 155 KB conda-forge
cffi-1.15.1 | py39h131948b_2 220 KB conda-forge
charset-normalizer-2.1.1 | pyhd8ed1ab_0 36 KB conda-forge
colorama-0.4.6 | pyhd8ed1ab_0 25 KB conda-forge
conda-22.9.0 | py39h6e9494a_2 962 KB conda-forge
conda-package-handling-1.9.0| py39ha30fb19_1 1.7 MB conda-forge
cryptography-38.0.3 | py39hbeae22c_0 1.2 MB conda-forge
idna-3.4 | pyhd8ed1ab_0 55 KB conda-forge
libffi-3.4.2 | h0d85af4_5 50 KB conda-forge
libsqlite-3.40.0 | ha978bb4_0 873 KB conda-forge
libzlib-1.2.13 | hfd90126_4 64 KB conda-forge
ncurses-6.3 | h96cf925_1 915 KB conda-forge
openssl-3.0.7 | hfd90126_0 2.5 MB conda-forge
pip-22.3.1 | pyhd8ed1ab_0 1.5 MB conda-forge
pycosat-0.6.4 | py39ha30fb19_1 110 KB conda-forge
pycparser-2.21 | pyhd8ed1ab_0 100 KB conda-forge
pyopenssl-22.1.0 | pyhd8ed1ab_0 122 KB conda-forge
pysocks-1.7.1 | pyha2e5f31_6 19 KB conda-forge
python-3.9.13 |hf8d34f4_0_cpython 12.8 MB conda-forge
python.app-1.4 | py39ha30fb19_1 13 KB conda-forge
python_abi-3.9 | 2_cp39 4 KB conda-forge
readline-8.1.2 | h3899abd_0 266 KB conda-forge
requests-2.28.1 | pyhd8ed1ab_1 53 KB conda-forge
ruamel_yaml-0.15.80 |py39ha30fb19_1008 246 KB conda-forge
setuptools-65.5.1 | pyhd8ed1ab_0 731 KB conda-forge
sqlite-3.40.0 | h9ae0607_0 885 KB conda-forge
tk-8.6.12 | h5dbffcc_0 3.4 MB conda-forge
toolz-0.12.0 | pyhd8ed1ab_0 48 KB conda-forge
tqdm-4.64.1 | pyhd8ed1ab_0 82 KB conda-forge
tzdata-2022f | h191b570_0 118 KB conda-forge
urllib3-1.26.11 | pyhd8ed1ab_0 102 KB conda-forge
wheel-0.38.4 | pyhd8ed1ab_0 32 KB conda-forge
xz-5.2.6 | h775f41a_0 233 KB conda-forge
yaml-0.2.5 | h0d85af4_2 82 KB conda-forge
------------------------------------------------------------
Total: 30.1 MB
The following NEW packages will be INSTALLED:
bzip2 conda-forge/osx-64::bzip2-1.0.8-h0d85af4_4
libsqlite conda-forge/osx-64::libsqlite-3.40.0-ha978bb4_0
libzlib conda-forge/osx-64::libzlib-1.2.13-hfd90126_4
python_abi conda-forge/osx-64::python_abi-3.9-2_cp39
toolz conda-forge/noarch::toolz-0.12.0-pyhd8ed1ab_0
The following packages will be REMOVED:
conda-content-trust-0.1.1-pyhd3eb1b0_0
libcxx-12.0.0-h2f01273_0
six-1.16.0-pyhd3eb1b0_1
zlib-1.2.12-h4dc903c_1
The following packages will be UPDATED:
brotlipy pkgs/main::brotlipy-0.7.0-py39h9ed202~ --> conda-forge::brotlipy-0.7.0-py39ha30fb19_1005
ca-certificates pkgs/main::ca-certificates-2022.3.29-~ --> conda-forge::ca-certificates-2022.9.24-h033912b_0
certifi pkgs/main/osx-64::certifi-2021.10.8-p~ --> conda-forge/noarch::certifi-2022.9.24-pyhd8ed1ab_0
cffi pkgs/main::cffi-1.15.0-py39hc55c11b_1 --> conda-forge::cffi-1.15.1-py39h131948b_2
charset-normalizer pkgs/main::charset-normalizer-2.0.4-p~ --> conda-forge::charset-normalizer-2.1.1-pyhd8ed1ab_0
colorama pkgs/main::colorama-0.4.4-pyhd3eb1b0_0 --> conda-forge::colorama-0.4.6-pyhd8ed1ab_0
conda pkgs/main::conda-4.12.0-py39hecd8cb5_0 --> conda-forge::conda-22.9.0-py39h6e9494a_2
conda-package-han~ pkgs/main::conda-package-handling-1.8~ --> conda-forge::conda-package-handling-1.9.0-py39ha30fb19_1
cryptography pkgs/main::cryptography-36.0.0-py39hf~ --> conda-forge::cryptography-38.0.3-py39hbeae22c_0
idna pkgs/main::idna-3.3-pyhd3eb1b0_0 --> conda-forge::idna-3.4-pyhd8ed1ab_0
libffi pkgs/main::libffi-3.3-hb1e8313_2 --> conda-forge::libffi-3.4.2-h0d85af4_5
openssl pkgs/main::openssl-1.1.1n-hca72f7f_0 --> conda-forge::openssl-3.0.7-hfd90126_0
pip pkgs/main/osx-64::pip-21.2.4-py39hecd~ --> conda-forge/noarch::pip-22.3.1-pyhd8ed1ab_0
pycosat pkgs/main::pycosat-0.6.3-py39h9ed2024~ --> conda-forge::pycosat-0.6.4-py39ha30fb19_1
pyopenssl pkgs/main::pyopenssl-22.0.0-pyhd3eb1b~ --> conda-forge::pyopenssl-22.1.0-pyhd8ed1ab_0
pysocks pkgs/main/osx-64::pysocks-1.7.1-py39h~ --> conda-forge/noarch::pysocks-1.7.1-pyha2e5f31_6
python pkgs/main::python-3.9.12-hdfd78df_0 --> conda-forge::python-3.9.13-hf8d34f4_0_cpython
requests pkgs/main::requests-2.27.1-pyhd3eb1b0~ --> conda-forge::requests-2.28.1-pyhd8ed1ab_1
setuptools pkgs/main/osx-64::setuptools-61.2.0-p~ --> conda-forge/noarch::setuptools-65.5.1-pyhd8ed1ab_0
sqlite pkgs/main::sqlite-3.38.2-h707629a_0 --> conda-forge::sqlite-3.40.0-h9ae0607_0
tk pkgs/main::tk-8.6.11-h7bc2e8c_0 --> conda-forge::tk-8.6.12-h5dbffcc_0
tqdm pkgs/main::tqdm-4.63.0-pyhd3eb1b0_0 --> conda-forge::tqdm-4.64.1-pyhd8ed1ab_0
tzdata pkgs/main::tzdata-2022a-hda174b7_0 --> conda-forge::tzdata-2022f-h191b570_0
urllib3 pkgs/main::urllib3-1.26.8-pyhd3eb1b0_0 --> conda-forge::urllib3-1.26.11-pyhd8ed1ab_0
wheel pkgs/main::wheel-0.37.1-pyhd3eb1b0_0 --> conda-forge::wheel-0.38.4-pyhd8ed1ab_0
xz pkgs/main::xz-5.2.5-h1de35cc_0 --> conda-forge::xz-5.2.6-h775f41a_0
yaml pkgs/main::yaml-0.2.5-haf1e3a3_0 --> conda-forge::yaml-0.2.5-h0d85af4_2
The following packages will be SUPERSEDED by a higher-priority channel:
ncurses pkgs/main::ncurses-6.3-hca72f7f_2 --> conda-forge::ncurses-6.3-h96cf925_1
pycparser pkgs/main::pycparser-2.21-pyhd3eb1b0_0 --> conda-forge::pycparser-2.21-pyhd8ed1ab_0
python.app pkgs/main::python.app-3-py39hca72f7f_0 --> conda-forge::python.app-1.4-py39ha30fb19_1
readline pkgs/main::readline-8.1.2-hca72f7f_1 --> conda-forge::readline-8.1.2-h3899abd_0
ruamel_yaml pkgs/main::ruamel_yaml-0.15.100-py39h~ --> conda-forge::ruamel_yaml-0.15.80-py39ha30fb19_1008
・・・省略・・・
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
conda-forgeを参照するようになりましたね。ついでにPythonのバージョンも3.9.12から3.9.13にアップデートされたようです。
念のためconda list -cコマンドで確認
(base) hinomaruc@myMBP ~ % conda list -c
conda-forge/osx-64::brotlipy-0.7.0-py39ha30fb19_1005 conda-forge/osx-64::bzip2-1.0.8-h0d85af4_4 conda-forge/osx-64::ca-certificates-2022.9.24-h033912b_0 conda-forge/noarch::certifi-2022.9.24-pyhd8ed1ab_0 conda-forge/osx-64::cffi-1.15.1-py39h131948b_2 conda-forge/noarch::charset-normalizer-2.1.1-pyhd8ed1ab_0 conda-forge/noarch::colorama-0.4.6-pyhd8ed1ab_0 conda-forge/osx-64::conda-22.9.0-py39h6e9494a_2 ・・・省略・・・
conda-forgeが先頭につくようになりました。
conda install numpy
・・・省略・・・ The following NEW packages will be INSTALLED: libblas conda-forge/osx-64::libblas-3.9.0-16_osx64_openblas None libcblas conda-forge/osx-64::libcblas-3.9.0-16_osx64_openblas None libcxx conda-forge/osx-64::libcxx-14.0.6-hccf4f1f_0 None libgfortran conda-forge/osx-64::libgfortran-5.0.0-9_5_0_h97931a8_26 None libgfortran5 conda-forge/osx-64::libgfortran5-11.3.0-h082f757_26 None liblapack conda-forge/osx-64::liblapack-3.9.0-16_osx64_openblas None libopenblas conda-forge/osx-64::libopenblas-0.3.21-openmp_h429af6e_3 None llvm-openmp conda-forge/osx-64::llvm-openmp-15.0.5-h61d9ccf_0 None numpy conda-forge/osx-64::numpy-1.23.4-py39hdfa1d0c_1 None ・・・省略・・・ Retrieving notices: ...working... done
conda-forgeチャンネルでインストールされるようなので問題なさそうです。
conda deactivate
hinomaruc@myMBP ~ %
ターミナルの先頭に(base)がついていなければbase環境から抜けることが出来ています。
Minicondaをアンインストールしたい場合
こちらの手順に沿って削除します。
下記ディレクトリと.bash_profileに記載されたMiniconda関係の記述を消すだけで良さそうです。
rm -rf ~/miniconda
rm -rf ~/.condarc ~/.conda ~/.continuum
Miniforge3でconda+conda-forge環境を構築
Miniforge3はこちらのgithubにまとめがあります。
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-x86_64.sh -O ~/miniforge.sh
--2022-11-19 21:57:45-- https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-x86_64.sh ・・・省略・・・ /Users/hinomaruc/miniforge.sh 100%[=======================================================>] 41.06M 2.73MB/s 時間 12s 2022-11-19 21:57:59 (3.42 MB/s) - `/Users/hinomaruc/miniforge.sh' へ保存完了 [43052853/43052853]
bash ~/miniforge.sh $HOME/miniforge
途中ENTERを押したり、ライセンスに同意したりする必要があります。
- In order to continue the installation process, please review the license
agreement.Please, press ENTER to continue (ライセンスの確認)
→ ENTER
- Do you accept the license terms? [yes|no] (ライセンスに同意するか)
→ yes
-
Miniforge3 will now be installed into this location: /Users/hinomaruc/miniforge3 (miniforge3のインストール場所の指定)
→ ENTER -
Do you wish the installer to initialize Miniforge3 by running conda init? [yes|no] (miniforge3の初期設定するかどうか。私はPATHをいじりたくないのでnoにしました)
→ no
Welcome to Miniforge3 22.9.0-1 ・・・省略・・・ + brotlipy 0.7.0 py310h90acd4f_1005 conda-forge/osx-64 Cached + bzip2 1.0.8 h0d85af4_4 conda-forge/osx-64 Cached + ca-certificates 2022.9.24 h033912b_0 conda-forge/osx-64 Cached + certifi 2022.9.24 pyhd8ed1ab_0 conda-forge/noarch Cached + cffi 1.15.1 py310ha78151a_2 conda-forge/osx-64 Cached + charset-normalizer 2.1.1 pyhd8ed1ab_0 conda-forge/noarch Cached + colorama 0.4.6 pyhd8ed1ab_0 conda-forge/noarch Cached + conda 22.9.0 py310h2ec42d9_1 conda-forge/osx-64 Cached + conda-package-handling 1.9.0 py310h90acd4f_1 conda-forge/osx-64 Cached + cryptography 38.0.2 py310hdd0c95c_2 conda-forge/osx-64 Cached + idna 3.4 pyhd8ed1ab_0 conda-forge/noarch Cached + libffi 3.4.2 h0d85af4_5 conda-forge/osx-64 Cached + libsqlite 3.39.4 ha978bb4_0 conda-forge/osx-64 Cached + libzlib 1.2.13 hfd90126_4 conda-forge/osx-64 Cached + ncurses 6.3 h96cf925_1 conda-forge/osx-64 Cached + openssl 3.0.5 hfd90126_2 conda-forge/osx-64 Cached + pip 22.3 pyhd8ed1ab_0 conda-forge/noarch Cached + pycosat 0.6.4 py310h90acd4f_1 conda-forge/osx-64 Cached + pycparser 2.21 pyhd8ed1ab_0 conda-forge/noarch Cached + pyopenssl 22.1.0 pyhd8ed1ab_0 conda-forge/noarch Cached + pysocks 1.7.1 pyha2e5f31_6 conda-forge/noarch Cached + python 3.10.6 hc14f532_0_cpython conda-forge/osx-64 Cached + python_abi 3.10 2_cp310 conda-forge/osx-64 Cached + readline 8.1.2 h3899abd_0 conda-forge/osx-64 Cached + requests 2.28.1 pyhd8ed1ab_1 conda-forge/noarch Cached + ruamel_yaml 0.15.80 py310h90acd4f_1008 conda-forge/osx-64 Cached + setuptools 65.5.0 pyhd8ed1ab_0 conda-forge/noarch Cached + tk 8.6.12 h5dbffcc_0 conda-forge/osx-64 Cached + toolz 0.12.0 pyhd8ed1ab_0 conda-forge/noarch Cached + tqdm 4.64.1 pyhd8ed1ab_0 conda-forge/noarch Cached + tzdata 2022e h191b570_0 conda-forge/noarch Cached + urllib3 1.26.11 pyhd8ed1ab_0 conda-forge/noarch Cached + wheel 0.37.1 pyhd8ed1ab_0 conda-forge/noarch Cached + xz 5.2.6 h775f41a_0 conda-forge/osx-64 Cached + yaml 0.2.5 h0d85af4_2 conda-forge/osx-64 Cached Summary: Install: 35 packages Total download: 0 B ・・・省略・・・ You have chosen to not have conda modify your shell scripts at all. To activate conda's base environment in your current shell session: eval "$(/Users/hinomaruc/miniforge3/bin/conda shell.YOUR_SHELL_NAME hook)" To install conda's shell functions for easier access, first activate, then: conda init If you'd prefer that conda's base environment not be activated on startup, set the auto_activate_base parameter to false: conda config --set auto_activate_base false Thank you for installing Miniforge3!
source ~/miniforge3/bin/activate
(base) hinomaruc@myMBP ~ % conda info
・・・一部省略・・・
active environment : base
active env location : /Users/hinomaruc/miniforge3
conda version : 22.9.0
python version : 3.10.6.final.0
base environment : /Users/hinomaruc/miniforge3 (writable)
channel URLs : https://conda.anaconda.org/conda-forge/osx-64
https://conda.anaconda.org/conda-forge/noarch
channel URLsが最初からconda-forgeのものになっていますね。
(base) hinomaruc@myMBP ~ % conda config --show channels
channels: - conda-forge
conda-forgeしか登録されていません。
miniforge3の方がconda環境の構築が楽ですね 笑
まとめ
Anacondaが有償化してから会社でcondaコマンドを使うことを避けていましたがこれなら使っても良さそうです。特にminiforge3は構築がかなり楽ちんなのでおすすめです。ライセンスを購入してまでという200名以上の企業所属の方はconda+conda-forgeの環境を構築してはいかがでしょうか?
