用conda安裝任何東西都報錯. 開始懷疑是公司的鬼網絡問題.
將.condarc重命名, 重新嘗試, 一切又很正常, 以為是清華源TUNA的問題, 還想去https://github.com/tuna/ 報錯.
后來一次將https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r channel一行在.condarc中刪掉后, 一切又正常了. 莫名其妙啊..
最開始時懷疑是 raise UnavailableInvalidChannel(self.url_w_repodata_fn, 404)的問題, 以為是清華源那邊缺失channeldata.json導致找不到subdir, 但關鍵的文件是repodata.json還是存在且一樣的. 可能不是TUNA的問題.
于是重新仔細追查錯誤, 發(fā)現(xiàn)這個錯誤有三處:
raise UnavailableInvalidChannel(self.url_w_repodata_fn, 404)raise Response304ContentUnchanged()json.decoder.JSONDecodeError: Unterminated string starting at: line 184947 column 5 (char 5586731)
第一個網絡是可以下載對應repodata.json的, 第二個304重定向應該不是, 第三個是json解碼的問題. 搜了一下, 找到以下帖子:
噢, 原來還是公司網絡的鍋. 肯定是之前update repo信息時網絡有問題, 于是就出現(xiàn)了污染.
解決辦法
conda clean -i
然后重新隨便install 個東西, 會重新下載repo信息. 問題解決. NND的公司網絡...
附錯誤內容:
$ conda install numpy
Collecting package metadata (current_repodata.json): failed
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/core/subdir_data.py", line 251, in _load
raise UnavailableInvalidChannel(self.url_w_repodata_fn, 404)
conda.exceptions.UnavailableInvalidChannel: The channel is not accessible or is invalid.
channel name: anaconda/pkgs/r
channel url: https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
error code: 404
You will need to adjust your conda configuration to proceed.
Use `conda config --show channels` to view your configuration's current state,
and use `conda config --show-sources` to view config file locations.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/core/subdir_data.py", line 248, in _load
repodata_fn=self.repodata_fn)
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/core/subdir_data.py", line 598, 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 "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1079, in __call__
return func(*args, **kwargs)
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/cli/main.py", line 84, in _main
exit_code = do_call(args, p)
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 82, in do_call
return getattr(module, func_name)(args, parser)
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 20, in execute
install(args, parser, 'install')
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/cli/install.py", line 265, in install
should_retry_solve=(_should_retry_unfrozen or repodata_fn != repodata_fns[-1]),
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 117, in solve_for_transaction
should_retry_solve)
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 158, in solve_for_diff
force_remove, should_retry_solve)
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 262, in solve_final_state
ssc = self._collect_all_metadata(ssc)
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/common/io.py", line 88, in decorated
return f(*args, **kwds)
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 415, in _collect_all_metadata
index, r = self._prepare(prepared_specs)
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/core/solve.py", line 1011, in _prepare
self.subdirs, prepared_specs, self._repodata_fn)
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/core/index.py", line 228, in get_reduced_index
repodata_fn=repodata_fn)
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/core/subdir_data.py", line 105, in query_all
result = tuple(concat(executor.map(subdir_query, channel_urls)))
File "/home/hom/Softwares/miniconda3/lib/python3.6/concurrent/futures/_base.py", line 586, in result_iterator
yield fs.pop().result()
File "/home/hom/Softwares/miniconda3/lib/python3.6/concurrent/futures/_base.py", line 425, in result
return self.__get_result()
File "/home/hom/Softwares/miniconda3/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/home/hom/Softwares/miniconda3/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/core/subdir_data.py", line 98, in <lambda>
package_ref_or_match_spec))
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/core/subdir_data.py", line 110, in query
self.load()
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/core/subdir_data.py", line 174, in load
_internal_state = self._load()
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/core/subdir_data.py", line 255, in _load
return self._load()
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/core/subdir_data.py", line 263, in _load
mod_etag_headers.get('_mod'))
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/core/subdir_data.py", line 311, in _read_local_repdata
_internal_state = self._process_raw_repodata_str(raw_repodata_str)
File "/home/hom/Softwares/miniconda3/lib/python3.6/site-packages/conda/core/subdir_data.py", line 349, in _process_raw_repodata_str
json_obj = json.loads(raw_repodata_str or '{}')
File "/home/hom/Softwares/miniconda3/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/home/hom/Softwares/miniconda3/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/home/hom/Softwares/miniconda3/lib/python3.6/json/decoder.py", line 355, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Unterminated string starting at: line 184947 column 5 (char 5586731)
# 這里省去一堆本地參數(shù)
An 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]:
Timeout reached. No report sent.