【Anaconda】conda-forgeチャネルを追加する方法

 

Anacondaではパッケージを検索したい場合は、以下のようにする。

 

anaconda search -t conda "パッケージ名"

 

例えば、opencvを探す場合は以下の通り。

 

anaconda search -t conda opencv

Using Anaconda API: https://api.anaconda.org
Packages:
     Name                      |  Version | Package Types   | Platforms       | Builds    
     ------------------------- |   ------ | --------------- | --------------- | ----------
     ???/opencv                |    2.4.7 | conda           | win-64          | np17py27_0
                                          : http://opencv.org/
     Definiter/opencv          |   2.4.12 | conda           | linux-64        | py27_2    
     FlyEM/opencv              | 2.4.10.1 | conda           | linux-64, osx-64 | 1         
                                          : Open source computer vision C++ library
     JaimeIvanCervantes/opencv | 2.4.9.99 | conda           | linux-64        | np19py27_0
     RahulJain/opencv          |   2.4.12 | conda           | linux-64, win-64, osx-64 | py27_2    
     Shravankumar147/opencv    |    3.3.0 | conda           | linux-64        | py36_blas_openblas_200
                                          : Computer vision and machine learning software library.
     Tallwhitebro/opencv       |    3.2.0 | conda           | linux-64        | np111py27_blas_openblas_203
     anaconda/libopencv        |    3.4.2 | conda           | linux-ppc64le, linux-64, win-32, osx-64, linux-32, win-64 | 
                                          : Computer vision and machine learning software library.
     anaconda/opencv           |    3.4.2 | conda           | linux-ppc64le, linux-64, win-32, osx-64, linux-32, win-64 | 
                                          : Computer vision and machine learning software library.
     andywocky/opencv          |    2.4.9 | conda           | osx-64          | np18py27_1
     asmeurer/opencv           |    2.4.9 | conda           | osx-64          | np18py27_0
     bgreen-litl/opencv        |    2.4.9 | conda           | osx-64          | np19py27_0
     boethus/opencv            |    3.2.0 | conda           | linux-64        | np112py27_blas_openblas_201
     brown-data-science/opencv |    3.1.0 | conda           | linux-64        | np113py27_0
     bwsprague/opencv          |  2.4.9.1 | conda           | osx-64          | np19py27_0
     cfobel/opencv-helpers     | 0.1.post1 | conda           | win-32          | 0         
     clinicalgraphics/opencv   |          | conda           | linux-64, win-32, osx-64, linux-32, win-64 | np19py27_0
     conda-forge/opencv        |    4.0.1 | conda           | linux-64, win-32, win-64, osx-64 |

 

一番左の名前だが”ユーザ名/パッケージ名”となっている。opencvを提供しているかなり多くのユーザやチャンネルがいることがわかった。

 

conda-forgeと言うチャンネルが信頼できるようなのでここからopencvをダウンロードするようにする。

 

チャンネルを指定してインストールするには以下のようにする。

conda install -c conda-forge opencv

 

毎回チャンネルを指定するのが面倒な場合は、condaの設定でチャンネルを追加することができる。

conda config --add channels conda-forge

 

確認は以下のコマンドでする。

conda config --get channels
--add channels 'defaults'   # lowest priority
--add channels 'conda-forge'   # highest priority

 

追加したconda-forgeの優先度が高いのは嫌だなって人は、一度削除してから`append`すると良いらしい。

 

(Python3) matsu@gpu-server:~$ conda config --get channels
--add channels 'defaults'   # lowest priority
--add channels 'conda-forge'   # highest priority
(Python3) matsu@gpu-server:~$ conda config --remove channels conda-forge
(Python3) matsu@gpu-server:~$ conda config --get channels
--add channels 'defaults'   # lowest priority
(Python3) matsu@gpu-server:~$ conda config --append channels conda-forge
(Python3) matsu@gpu-server:~$ conda config --get channels
--add channels 'conda-forge'   # lowest priority
--add channels 'defaults'   # highest priority

 

おわり。

 

参考:

いろいろ忘備録日記:https://devlights.hatenablog.com/entry/2017/12/09/183715

ABOUTこの記事をかいた人

個人アプリ開発者。Python、Swift、Unityのことを発信します。月間2.5万PVブログ運営。 Twitter:@yamagablog