原因

由于第一次安装了conda,但非自己想要的conda安装目录,通过以下命令进行卸载,后重新安装,重新定义新的安装路径。

#### 卸载conda

rm -rf ~/miniconda3/
conda clean -i
vim ~/.bashrc
# added by Miniconda3 installer
export PATH="/home/toucan/miniconda3/bin:$PATH"

也可以编辑~/.bash_profile并删除从你的PATH环境变量中删除miniconda目录,并删除隐藏.condarc文件以及可能已创建的.conda.continuum目录在主目录下用
rm -rf ~/.condarc ~/.conda ~/.continuum

安装软件,出现报错,怀疑是镜像问题

$conda install fastp
Solving environment: failed

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/opt/conda/lib/python3.7/site-packages/conda/core/subdir_data.py", line 227, in _load
        mod_etag_headers.get('_mod'))
      File "/opt/conda/lib/python3.7/site-packages/conda/core/subdir_data.py", line 574, in fetch_repodata_remote_request
        raise Response304ContentUnchanged()
    conda.core.subdir_data.Response304ContentUnchanged

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/opt/conda/lib/python3.7/site-packages/conda/exceptions.py", line 819, in __call__
        return func(*args, **kwargs)
      File "/opt/conda/lib/python3.7/site-packages/conda/cli/main.py", line 78, in _main
        exit_code = do_call(args, p)
      File "/opt/conda/lib/python3.7/site-packages/conda/cli/conda_argparse.py", line 77, in do_call
        exit_code = getattr(module, func_name)(args, parser)
      File "/opt/conda/lib/python3.7/site-packages/conda/cli/main_install.py", line 11, in execute
        install(args, parser, 'install')
      File "/opt/conda/lib/python3.7/site-packages/conda/cli/install.py", line 235, in install
        force_reinstall=context.force,
      File "/opt/conda/lib/python3.7/site-packages/conda/core/solve.py", line 518, in solve_for_transaction
        force_remove, force_reinstall)
      File "/opt/conda/lib/python3.7/site-packages/conda/core/solve.py", line 451, in solve_for_diff
        final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove)
      File "/opt/conda/lib/python3.7/site-packages/conda/core/solve.py", line 180, in solve_final_state
        index, r = self._prepare(prepared_specs)
      File "/opt/conda/lib/python3.7/site-packages/conda/core/solve.py", line 592, in _prepare
        self.subdirs, prepared_specs)
      File "/opt/conda/lib/python3.7/site-packages/conda/core/index.py", line 215, in get_reduced_index
        new_records = query_all(spec)
      File "/opt/conda/lib/python3.7/site-packages/conda/core/index.py", line 184, in query_all
        return tuple(concat(future.result() for future in as_completed(futures)))
      File "/opt/conda/lib/python3.7/site-packages/conda/core/subdir_data.py", line 95, in query
        self.load()
      File "/opt/conda/lib/python3.7/site-packages/conda/core/subdir_data.py", line 149, in load
        _internal_state = self._load()
      File "/opt/conda/lib/python3.7/site-packages/conda/core/subdir_data.py", line 233, in _load
        mod_etag_headers.get('_mod'))
      File "/opt/conda/lib/python3.7/site-packages/conda/core/subdir_data.py", line 280, in _read_local_repdata
        _internal_state = self._process_raw_repodata_str(raw_repodata_str)
      File "/opt/conda/lib/python3.7/site-packages/conda/core/subdir_data.py", line 317, in _process_raw_repodata_str
        json_obj = json.loads(raw_repodata_str or '{}')
      File "/opt/conda/lib/python3.7/json/__init__.py", line 348, in loads
        return _default_decoder.decode(s)
      File "/opt/conda/lib/python3.7/json/decoder.py", line 337, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "/opt/conda/lib/python3.7/json/decoder.py", line 353, in raw_decode
        obj, end = self.scan_once(s, idx)
    json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 10485587 (char 10485586)

解决方法

# 卸载
rm -rf conda/
rm -rf .conda. bashrc-miniconda3.bak

# 删除环境变量
# added by Miniconda3 installer
export PATH="/opt/conda/bin:$PATH"

# 重新安装
bash ~/opt/sysoft/Miniconda3-latest-Linux-x86_64.sh

# 设置新安装路径
[/home/toucan/miniconda3] >>> /opt/conda

# 添加环境变量
to PATH in your /home/toucan/.bashrc ? [yes|no]
[no] >>> yes

查看镜像

# 查看镜像为空
$conda config --get channels
toucan@tssys /home/toucan  Thu Sep 13 13:04  forstart

# 查看配置文件,为空
vim ~/.condarc
设置镜像
vim ~/.condarc
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - defaults
  - r
show_channel_urls: true

查看镜像,bioconda是最高级别

$conda config --get channels
--add channels 'r'   # lowest priority
--add channels 'defaults'
--add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'
--add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/'
--add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/'
--add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/'   # highest priority
成功安装软件
conda install -c bioconda -y bwa
Logo

更多推荐