本文主要是介绍【报错】Anaconda Collecting package metadata (repodata.json): failed,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1. 报错原因
我想卸载python,然后报错如下。
(ptc) C:\Users\Lion>conda uninstall python
Collecting package metadata (repodata.json): failed# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<Traceback (most recent call last):File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\core\subdir_data.py", line 244, in _loadraw_repodata_str = fetch_repodata_remote_request(File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\core\subdir_data.py", line 598, in fetch_repodata_remote_requestraise Response304ContentUnchanged()conda.core.subdir_data.Response304ContentUnchangedDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\exceptions.py", line 1079, in __call__return func(*args, **kwargs)File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\cli\main.py", line 84, in _mainexit_code = do_call(args, p)File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\cli\conda_argparse.py", line 83, in do_callreturn getattr(module, func_name)(args, parser)File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\cli\main_remove.py", line 89, in executetxn = solver.solve_for_transaction()File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\core\solve.py", line 114, in solve_for_transactionunlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\core\solve.py", line 157, in solve_for_difffinal_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\core\solve.py", line 262, in solve_final_statessc = self._collect_all_metadata(ssc)File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\common\io.py", line 88, in decoratedreturn f(*args, **kwds)File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\core\solve.py", line 425, in _collect_all_metadataindex, r = self._prepare(prepared_specs)File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\core\solve.py", line 1020, in _preparereduced_index = get_reduced_index(self.prefix, self.channels,File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\core\index.py", line 227, in get_reduced_indexnew_records = SubdirData.query_all(spec, channels=channels, subdirs=subdirs,File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\core\subdir_data.py", line 105, in query_allresult = tuple(concat(executor.map(subdir_query, channel_urls)))File "D:\ProgramFiles\Anaconda\lib\concurrent\futures\_base.py", line 611, in result_iteratoryield fs.pop().result()File "D:\ProgramFiles\Anaconda\lib\concurrent\futures\_base.py", line 439, in resultreturn self.__get_result()File "D:\ProgramFiles\Anaconda\lib\concurrent\futures\_base.py", line 388, in __get_resultraise self._exceptionFile "D:\ProgramFiles\Anaconda\lib\concurrent\futures\thread.py", line 57, in runresult = self.fn(*self.args, **self.kwargs)File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\core\subdir_data.py", line 97, in <lambda>subdir_query = lambda url: tuple(SubdirData(Channel(url), repodata_fn=repodata_fn).query(File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\core\subdir_data.py", line 110, in queryself.load()File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\core\subdir_data.py", line 174, in load_internal_state = self._load()File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\core\subdir_data.py", line 262, in _load_internal_state = self._read_local_repdata(mod_etag_headers.get('_etag'),File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\core\subdir_data.py", line 311, in _read_local_repdata_internal_state = self._process_raw_repodata_str(raw_repodata_str)File "D:\ProgramFiles\Anaconda\lib\site-packages\conda\core\subdir_data.py", line 349, in _process_raw_repodata_strjson_obj = json.loads(raw_repodata_str or '{}')File "D:\ProgramFiles\Anaconda\lib\json\__init__.py", line 357, in loadsreturn _default_decoder.decode(s)File "D:\ProgramFiles\Anaconda\lib\json\decoder.py", line 337, in decodeobj, end = self.raw_decode(s, idx=_w(s, 0).end())File "D:\ProgramFiles\Anaconda\lib\json\decoder.py", line 353, in raw_decodeobj, end = self.scan_once(s, idx)json.decoder.JSONDecodeError: Unterminated string starting at: line 781976 column 7 (char 22331207)`$ D:\ProgramFiles\Anaconda\Scripts\conda-script.py uninstall python\`environment variables:CIO_TEST=<not set>CONDA_DEFAULT_ENV=ContinualRECONDA_EXE=D:\ProgramFiles\Anaconda\condabin\..\Scripts\conda.exeCONDA_EXES="D:\ProgramFiles\Anaconda\condabin\..\Scripts\conda.exe"CONDA_PREFIX=D:\ProgramFiles\Anaconda\envs\ContinualRECONDA_PREFIX_1=D:\ProgramFiles\AnacondaCONDA_PROMPT_MODIFIER=(ContinualRE)CONDA_PYTHON_EXE=D:\ProgramFiles\Anaconda\python.exeCONDA_ROOT=D:\ProgramFiles\AnacondaCONDA_SHLVL=2CURL_CA_BUNDLE=<not set>HOMEPATH=\Users\LionPATH=D:\ProgramFiles\Anaconda;D:\ProgramFiles\Anaconda\Library\mingw-w64\bin;D:\ProgramFiles\Anaconda\Library\usr\bin;D:\ProgramFiles\Anaconda\Library\bin;D:\ProgramFiles\Anaconda\Scripts;D:\ProgramFiles\Anaconda\bin;D:\ProgramFiles\Anaconda\envs\ContinualRE;D:\ProgramFiles\Anaconda\envs\ContinualRE\Library\mingw-w64\bin;D:\ProgramFiles\Anaconda\envs\ContinualRE\Library\usr\bin;D:\ProgramFiles\Anaconda\envs\ContinualRE\Library\bin;D:\ProgramFiles\Anaconda\envs\ContinualRE\Scripts;D:\ProgramFiles\Anaconda\envs\ContinualRE\bin;D:\ProgramFiles\Anaconda\condabin;.;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;D:\ProgramFiles\Git\cmd;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Users\Lion\AppData\Local\Microsoft\WindowsApps;.;D:\ProgramFiles\Microsoft VS Code\bin;C:\ProgramFiles\Intel\WiFi\bin;C:\Program Files\CommonFiles\Intel\WirelessCommon;D:\ProgramFiles\BandizipPSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\ModulesREQUESTS_CA_BUNDLE=<not set>SSL_CERT_FILE=<not set>active environment : ContinualREactive env location : D:\ProgramFiles\Anaconda\envs\ContinualREshell level : 2user config file : C:\Users\Lion\.condarcpopulated config files : C:\Users\Lion\.condarcconda version : 4.8.5conda-build version : 3.18.11python version : 3.8.3.final.0virtual packages : __cuda=8.0base environment : D:\ProgramFiles\Anaconda (writable)channel URLs : https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/win-64https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/noarchhttps://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/win-64https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarchhttps://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarchhttps://repo.anaconda.com/pkgs/main/win-64https://repo.anaconda.com/pkgs/main/noarchhttps://repo.anaconda.com/pkgs/r/win-64https://repo.anaconda.com/pkgs/r/noarchhttps://repo.anaconda.com/pkgs/msys2/win-64https://repo.anaconda.com/pkgs/msys2/noarchpackage cache : D:\ProgramFiles\Anaconda\pkgsC:\Users\Lion\.conda\pkgsC:\Users\Lion\AppData\Local\conda\conda\pkgsenvs directories : D:\ProgramFiles\Anaconda\envsC:\Users\Lion\.conda\envsC:\Users\Lion\AppData\Local\conda\conda\envsplatform : win-64user-agent : conda/4.8.5 requests/2.24.0 CPython/3.8.3 Windows/10 Windows/10.0.19041administrator : Falsenetrc file : Noneoffline mode : FalseAn unexpected error has occurred. Conda has prepared the above report.If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?[y/N]:No report sent. To permanently opt-out, use$ conda config --set report_errors false
2. 原因
镜像源错误。
首先执行:
conda clean -i
然后,在C:\Users\YOUR USER NAME找到.condarc;
然后把其中的内容替换成:
channels:- defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudmsys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudbioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudmenpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudpytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudsimpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
保存。
最后,执行卸载Python操作,成功!
参考感谢!
[1] conda常见报错以及解决方法【持续更新conda的其它报错以及解决方法。】
[2] 清华大学镜像站
https://www.codeleading.com/article/55094760021/
以上是作者的内容的链接。
在自己的电脑上安装Anaconda时,我遇到了几个问题记录下:
1. 安装Anaconda需要选择Just me
2. 创建虚拟环境出现问题
我按照上面的方法试了之后还是出现这样的问题,最后我关闭了代理才成功,真的让我匪夷所思。
这篇关于【报错】Anaconda Collecting package metadata (repodata.json): failed的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!