遺伝研のスパコンでローカルにminiconda3をインストールして使っていたら、condaのbaseとenvのパスが、システムのパス(/opt/)になってしまったときの解決法。理由は、単にconda deactivate baseをしてしまったこと、かもしれない。
スパコンでのminiconda3のインストール https://sc.ddbj.nig.ac.jp/software/python/
$ conda info
active environment : base
active env location : /opt/pkg/intel/oneapi/intelpython/latest
shell level : 1
user config file : /home/hoge/.condarc
populated config files : /opt/pkg/intel/oneapi/intelpython/latest/.condarc
/home/hoge/.condarc
conda version : 4.11.0
conda-build version : not installed
python version : 3.9.10.final.0
virtual packages : __linux=3.10.0=0
__glibc=2.17=0
__unix=0=0
__archspec=1=x86_64
base environment : /opt/pkg/intel/oneapi/intelpython/latest (read only)
conda av data dir : /opt/pkg/intel/oneapi/intelpython/latest/etc/conda
conda av metadata url : None
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
https://conda.anaconda.org/conda-forge/linux-64
https://conda.anaconda.org/conda-forge/noarch
https://conda.anaconda.org/bioconda/linux-64
https://conda.anaconda.org/bioconda/noarch
file:///opt/pkg/intel/oneapi/conda_channel/linux-64
file:///opt/pkg/intel/oneapi/conda_channel/noarch
https://conda.anaconda.org/intel/linux-64
https://conda.anaconda.org/intel/noarch
package cache : /opt/pkg/intel/oneapi/intelpython/latest/pkgs
/home/hoge/.conda/pkgs
envs directories : /home/hoge/.conda/envs
/opt/pkg/intel/oneapi/intelpython/latest/envs
platform : linux-64
user-agent : conda/4.11.0 requests/2.28.1 CPython/3.9.10 Linux/3.10.0-1160.el7.x86_64 centos/7.9.2009 glibc/2.17
UID:GID : 3167:10805
netrc file : None
offline mode : False
解決法
$ source /home/hoge/miniconda3/etc/profile.d/conda.sh
実はsourceを使う方法は上記のスパコンのページで紹介しているので、それに従えば良かっただけ。
conda initではうまくいかないので注意。