[conda报错 已解决]An unexpected error has occurred. Conda has prepared the above report.

[conda报错 已解决]An unexpected error has occurred. Conda has prepared the above report.

在主机上的服务器里用miniconda安装新环境时,输入
conda create -n name python==x.x.x时安装失败,遇到了An unexpected error has occurred. Conda has prepared the above report.问题。.

// 显示以下内容
Collecting package metadata (current_repodata.json): failed

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

    Traceback (most recent call last):
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1079, in __call__
        return func(*args, **kwargs)
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/cli/main.py", line 84, in _main
        exit_code = do_call(args, p)
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/cli/conda_argparse.py", line 83, in do_call
        return getattr(module, func_name)(args, parser)
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/cli/main_create.py", line 41, in execute
        install(args, parser, 'create')
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/cli/install.py", line 261, in install
        unlink_link_transaction = solver.solve_for_transaction(
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/core/solve.py", line 114, in solve_for_transaction
        unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/core/solve.py", line 157, in solve_for_diff
        final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/core/solve.py", line 262, in solve_final_state
        ssc = self._collect_all_metadata(ssc)
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/common/io.py", line 88, in decorated
        return f(*args, **kwds)
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/core/solve.py", line 425, in _collect_all_metadata
        index, r = self._prepare(prepared_specs)
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/core/solve.py", line 1020, in _prepare
        reduced_index = get_reduced_index(self.prefix, self.channels,
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/core/index.py", line 288, in get_reduced_index
        new_records = SubdirData.query_all(spec, channels=channels, subdirs=subdirs,
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/core/subdir_data.py", line 140, in query_all
        result = tuple(concat(executor.map(subdir_query, channel_urls)))
      File "/home/wangchunxiao/miniconda3/lib/python3.9/concurrent/futures/_base.py", line 608, in result_iterator
        yield fs.pop().result()
      File "/home/wangchunxiao/miniconda3/lib/python3.9/concurrent/futures/_base.py", line 438, in result
        return self.__get_result()
      File "/home/wangchunxiao/miniconda3/lib/python3.9/concurrent/futures/_base.py", line 390, in __get_result
        raise self._exception
      File "/home/wangchunxiao/miniconda3/lib/python3.9/concurrent/futures/thread.py", line 52, in run
        result = self.fn(*self.args, **self.kwargs)
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/core/subdir_data.py", line 132, in <lambda>
        subdir_query = lambda url: tuple(SubdirData(Channel(url), repodata_fn=repodata_fn).query(
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/core/subdir_data.py", line 145, in query
        self.load()
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/core/subdir_data.py", line 210, in load
        _internal_state = self._load()
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/core/subdir_data.py", line 407, in _load
        _internal_state = self._process_raw_repodata_str(raw_repodata_str)
      File "/home/wangchunxiao/miniconda3/lib/python3.9/site-packages/conda/core/subdir_data.py", line 480, in _process_raw_repodata_str
        json_obj = json.loads(raw_repodata_str or '{}')
      File "/home/wangchunxiao/miniconda3/lib/python3.9/json/__init__.py", line 346, in loads
        return _default_decoder.decode(s)
      File "/home/wangchunxiao/miniconda3/lib/python3.9/json/decoder.py", line 337, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "/home/wangchunxiao/miniconda3/lib/python3.9/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 41 (char 40)

`$ /home/wangchunxiao/miniconda3/bin/conda create -n P5 python==3.9.7`

  environment variables:
                 CIO_TEST=<not set>
        CONDA_DEFAULT_ENV=base
                CONDA_EXE=/home/wangchunxiao/miniconda3/bin/conda
             CONDA_PREFIX=/home/wangchunxiao/miniconda3
    CONDA_PROMPT_MODIFIER=(base)
         CONDA_PYTHON_EXE=/home/wangchunxiao/miniconda3/bin/python
               CONDA_ROOT=/home/wangchunxiao/miniconda3
              CONDA_SHLVL=1
           CURL_CA_BUNDLE=<not set>
                     PATH=/home/wangchunxiao/miniconda3/bin:/home/wangchunxiao/miniconda3/bin:/h
                          ome/wangchunxiao/miniconda3/condabin:/usr/local/bin:/usr/bin:/usr/loca
                          l/sbin:/usr/sbin:/home/wangchunxiao/.local/bin:/home/wangchunxiao/bin
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : base
    active env location : /home/wangchunxiao/miniconda3
            shell level : 1
       user config file : /home/wangchunxiao/.condarc
 populated config files : /home/wangchunxiao/.condarc
          conda version : 4.10.3
    conda-build version : not installed
         python version : 3.9.5.final.0
       virtual packages : __cuda=10.2=0
                          __linux=3.10.0=0
                          __glibc=2.17=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/wangchunxiao/miniconda3  (writable)
      conda av data dir : /home/wangchunxiao/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://anaconda.org/linux-64
                          https://anaconda.org/noarch
                          https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/noarch
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/linux-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/noarch
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/linux-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
          package cache : /home/wangchunxiao/miniconda3/pkgs
                          /home/wangchunxiao/.conda/pkgs
       envs directories : /home/wangchunxiao/miniconda3/envs
                          /home/wangchunxiao/.conda/envs
               platform : linux-64
             user-agent : conda/4.10.3 requests/2.25.1 CPython/3.9.5 Linux/3.10.0-1160.6.1.el7.x86_64 centos/7.5.1804 glibc/2.17
                UID:GID : 1004:1004
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.

Upload did not complete.

解决方法一(用此方法解决)参考链接

一、输入以下代码,查看是否存在.condarc文件。

$ conda config --show-sources

出现以下代码,就代表根目录下自动生成了.condarc文件

==> /home/wangchunxiao/.condarc <==

二、如果生成了此文件,将此文件删除

rm -rf ~/.condarc

预备方法

1、关闭VPN!(在用上面的方法时,我已经提前将VPN关掉了,不知道原理但是可以试试。)参考链接
2、尝试输入以下命令行。(尝试过了,没有奏效也没出别的大事)参考链接

conda clean -i
#这句话的目的是删除缓存和索引。

3、尝试输入以下命令行。(没有尝试,看起来很吓人,不敢动!)参考链接

conda clean --packages && conda clean --all && conda update --all
#清除所有包,清除所有东西,更新所有东西
物联沃分享整理
物联沃-IOTWORD物联网 » [conda报错 已解决]An unexpected error has occurred. Conda has prepared the above report.

发表评论