创造虚拟环境报错An unexpected error has occurred. Conda has prepared the above report.解决方案

一、创造一个虚拟环境报错**:**


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

Upload did not complete.

具体如下:

`$ D:\Software\Anaconda3\Path\Scripts\conda-script.py create -n PRE`

  environment variables:
                 CIO_TEST=<not set>
        CONDA_DEFAULT_ENV=base
                CONDA_EXE=D:\Software\Anaconda3\Path\condabin\..\Scripts\conda.exe
               CONDA_EXES="D:\Software\Anaconda3\Path\condabin\..\Scripts\conda.exe"
             CONDA_PREFIX=D:\Software\Anaconda3\Path
    CONDA_PROMPT_MODIFIER=(base)
         CONDA_PYTHON_EXE=D:\Software\Anaconda3\Path\python.exe
               CONDA_ROOT=D:\Software\Anaconda3\Path
              CONDA_SHLVL=1
                CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0
           CURL_CA_BUNDLE=<not set>
                 HOMEPATH=\Users\Camila
          MOZ_PLUGIN_PATH=D:\Software\Foxit\Path\Foxit PDF Reader\plugins\
          NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt\
                     PATH=D:\Software\Anaconda3\Path;D:\Software\Anaconda3\Path\Library\mingw-w6
                          4\bin;D:\Software\Anaconda3\Path\Library\usr\bin;D:\Software\Anaconda3
                          \Path\Library\bin;D:\Software\Anaconda3\Path\Scripts;D:\Software\Anaco
                          nda3\Path\bin;D:\Software\Anaconda3\Path;D:\Software\Anaconda3\Path\Li
                          brary\mingw-w64\bin;D:\Software\Anaconda3\Path\Library\usr\bin;D:\Soft
                          ware\Anaconda3\Path\Library\bin;D:\Software\Anaconda3\Path\Scripts;D:\
                          Software\Anaconda3\Path\bin;D:\Software\Anaconda3\Path\condabin;C:\Pro
                          gram Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin;C:\Program
                          Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\libnvvp;C:\Windows\syste
                          m32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPow
                          erShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\NVIDIA
                          Corporation\Nsight Compute 2020.1.1;C:\Program Files (x86)\NVIDIA
                          Corporation\PhysX\Common;D:\Software\Matlab
                          R2017b\path\runtime\win64;D:\Software\Matlab R2017b\path\bin;C:\Users\
                          Camila\AppData\Local\Microsoft\WindowsApps;.;D:\Software\Pycharm-2021\
                          Path\PyCharm 2021.1\bin;.;C:\Program Files\Bandizip
             PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\Windows
                          PowerShell\v1.0\Modules
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : base
    active env location : D:\Software\Anaconda3\Path
            shell level : 1
       user config file : C:\Users\Camila\.condarc
 populated config files : C:\Users\Camila\.condarc
          conda version : 4.10.1
    conda-build version : 3.21.4
         python version : 3.8.8.final.0
       virtual packages : __cuda=11.2=0
                          __win=0=0
                          __archspec=1=x86_64
       base environment : D:\Software\Anaconda3\Path  (writable)
      conda av data dir : D:\Software\Anaconda3\Path\etc\conda
  conda av metadata url : https://repo.anaconda.com/pkgs/main
           channel URLs : https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : D:\Software\Anaconda3\Path\pkgs
                          C:\Users\Camila\.conda\pkgs
                          C:\Users\Camila\AppData\Local\conda\conda\pkgs
       envs directories : D:\Software\Anaconda3\Path\envs
                          C:\Users\Camila\.conda\envs
                          C:\Users\Camila\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.10.1 requests/2.25.1 CPython/3.8.8 Windows/10 Windows/10.0.19041
          administrator : False
             netrc file : None
           offline mode : False


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

Upload did not complete.

二、分析原因

由于之前改BUG需要升级conda,然后惊讶的发现conda没法升级,conda update conda之后会提示出错an unexpected error has occurred. conda has prepared the above report. Upload did not complete.

后续导致我创建虚拟环境报错,于是查找相关解决方案解决问题。

三、解决方案
网友提供较多的方案。仅供参考,本人是第三种情况,同样解决了。

  1. 删除.condarc文件

这个文件位置一般为C:\User\Administrator.condarc,如果设置了清华/中科大源,里面会保存这些镜像源的地址,删除了这个文件其实就是类似于恢复使用官方源。

  1. 清理缓存索引
    删除conda中的缓存索引,运行如下命令:
conda clean -i
  1. 我的情况很简单,但是分析对问题解决就很简单

但是!!!
我使用第1、2种解决方案均无效,然后在网上看到UU们给出了一条建议:

try close your VPN

发现了自己最大问题在于使用了外网,关闭后,问题得以解决。特此记录!!!

来源:消灭BUG鸭

物联沃分享整理
物联沃-IOTWORD物联网 » 创造虚拟环境报错An unexpected error has occurred. Conda has prepared the above report.解决方案

发表评论