conda.core.subdir_data.Response304ContentUnchanged && CondaHTTPError: HTTP 000 CONNECTION FAILED

conda.core.subdir_data.Response304ContentUnchanged && CondaHTTPError: HTTP 000 CONNECTION FAILED

问题情况

在复现RCAN的时候,用的python的代码是3.6的,而且pytorch要0.4.0,打算创个新的虚拟环境。

(base) C:\Users\HP>conda create -n pytorch0.4.0 python=3.6
Collecting package metadata: failed

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

    Traceback (most recent call last):
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 218, in _load
        mod_etag_headers.get('_mod'))
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 538, 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 "C:\Users\HP\Anaconda3\lib\site-packages\conda\exceptions.py", line 1003, in __call__
        return func(*args, **kwargs)
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\cli\main.py", line 84, in _main
        exit_code = do_call(args, p)
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 82, in do_call
        exit_code = getattr(module, func_name)(args, parser)
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\cli\main_create.py", line 37, in execute
        install(args, parser, 'create')
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\cli\install.py", line 257, in install
        force_reinstall=context.force_reinstall or context.force,
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\core\solve.py", line 107, in solve_for_transaction
        force_remove, force_reinstall)
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\core\solve.py", line 145, in solve_for_diff
        force_remove)
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\core\solve.py", line 235, in solve_final_state
        ssc = self._collect_all_metadata(ssc)
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\common\io.py", line 88, in decorated
        return f(*args, **kwds)
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\core\solve.py", line 286, in _collect_all_metadata
        index, r = self._prepare(prepared_specs)
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\core\solve.py", line 688, in _prepare
        self.subdirs, prepared_specs)
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\core\index.py", line 213, in get_reduced_index
        new_records = query_all(spec)
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\core\index.py", line 176, in query_all
        return tuple(concat(future.result() for future in as_completed(futures)))
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 93, in query
        self.load()
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 147, in load
        _internal_state = self._load()
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 224, in _load
        mod_etag_headers.get('_mod'))
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 271, in _read_local_repdata
        _internal_state = self._process_raw_repodata_str(raw_repodata_str)
      File "C:\Users\HP\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 308, in _process_raw_repodata_str
        json_obj = json.loads(raw_repodata_str or '{}')
      File "C:\Users\HP\Anaconda3\lib\json\__init__.py", line 348, in loads
        return _default_decoder.decode(s)
      File "C:\Users\HP\Anaconda3\lib\json\decoder.py", line 337, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "C:\Users\HP\Anaconda3\lib\json\decoder.py", line 353, in raw_decode
        obj, end = self.scan_once(s, idx)
    json.decoder.JSONDecodeError: Unterminated string starting at: line 228872 column 14 (char 6913854)

`$ C:\Users\HP\Anaconda3\Scripts\conda-script.py create -n pytorch0.4.0 python=3.6`

  environment variables:
                 CIO_TEST=<not set>
        CONDA_DEFAULT_ENV=base
                CONDA_EXE=C:\Users\HP\Anaconda3\condabin\..\Scripts\conda.exe
               CONDA_EXES="C:\Users\HP\Anaconda3\condabin\..\Scripts\conda.exe"
             CONDA_PREFIX=C:\Users\HP\Anaconda3
    CONDA_PROMPT_MODIFIER=(base)
         CONDA_PYTHON_EXE=C:\Users\HP\Anaconda3\python.exe
               CONDA_ROOT=C:\Users\HP\Anaconda3
              CONDA_SHLVL=1
                CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1
                 HOMEPATH=\Users\HP
          NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt\
                     PATH=C:\Users\HP\Anaconda3;C:\Users\HP\Anaconda3\Library\mingw-w64\bin;C:\U
                          sers\HP\Anaconda3\Library\usr\bin;C:\Users\HP\Anaconda3\Library\bin;C:
                          \Users\HP\Anaconda3\Scripts;C:\Users\HP\Anaconda3\bin;C:\Users\HP\Anac
                          onda3;C:\Users\HP\Anaconda3\Library\mingw-w64\bin;C:\Users\HP\Anaconda
                          3\Library\usr\bin;C:\Users\HP\Anaconda3\Library\bin;C:\Users\HP\Anacon
                          da3\Scripts;C:\Users\HP\Anaconda3\bin;C:\Users\HP\Anaconda3\condabin;C
                          :\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin;C:\Program
                          Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp;D:\anaconda\soft
                          ;D:\anaconda\soft\Library\mingw-w64\bin;D:\anaconda\soft\Library\usr\b
                          in;D:\anaconda\soft\Library\bin;D:\anaconda\soft\Scripts;D:\zfy\caffe-
                          master\Build\x64\Release;E:\hzl
                          program\并行编程\tbb2018_20170726oss\bin\intel64\vc14;C:\Program
                          Files\MATLAB\R2017b\bin\win64;C:\TDM-GCC-64\bin;C:\Windows\system32;C:
                          \Windows;C:\Windows\system32\wbem;C:\Program Files (x86)\NVIDIA
                          Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA
                          NvDLISR;C:\Program Files\NVIDIA Corporation\Nsight Compute
                          2019.4.0;C:\Program Files\NVIDIA GPU Computing
                          Toolkit\CUDA\v10.1\bin;D:\hxb;D:\zfy\caffe-
                          master\Build\x64\Release;E:\hzl
                          program\并行编程\tbb2018_20170726oss\bin\intel64\vc14;C:\Program
                          Files\JetBrains\PyCharm Community Edition 2019.1.3\bin;.
             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 : C:\Users\HP\Anaconda3
            shell level : 1
       user config file : C:\Users\HP\.condarc
 populated config files : C:\Users\HP\.condarc
          conda version : 4.6.14
    conda-build version : 3.15.1
         python version : 3.7.0.final.0
       base environment : C:\Users\HP\Anaconda3  (writable)
           channel URLs : https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
          package cache : C:\Users\HP\Anaconda3\pkgs
                          C:\Users\HP\.conda\pkgs
                          C:\Users\HP\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\HP\Anaconda3\envs
                          C:\Users\HP\.conda\envs
                          C:\Users\HP\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.6.14 requests/2.19.1 CPython/3.7.0 Windows/10 Windows/10.0.16299
          administrator : False
             netrc file : None
           offline mode : False


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]: y
Upload successful.

Thank you for helping to improve conda.
Opt-in to always sending reports (and not see this message again)
by running

    $ conda config --set report_errors true

这个是通过下面解决的

conda clean -i   

虽然说上面的问题不再显示,但是显示了别的问题,如下

新问题

(base) C:\Users\HP>conda create -n pytorch0.4.0 python=3.6
Collecting package metadata: failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/repodata.json>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
ConnectionError(ReadTimeoutError("HTTPSConnectionPool(host='mirrors.tuna.tsinghua.edu.cn', port=443): Read timed out."))

这个看上去就是说网络链接问题,或者说是源的问题,反正就是连接失败,重新输入语句很多次,也试了很多次换源等等操作,还是失败,给我整吐了。

新问题的解决方法

后来我就不打算创建新环境了,直接把旧的py3.6环境改一下,需要把pytorch1.2.1降到0.4.0。

(pytorch) C:\Users\HP>conda install pytorch=0.4.0
Collecting package metadata: failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64/repodata.json>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
ConnectionError(ReadTimeoutError("HTTPSConnectionPool(host='mirrors.tuna.tsinghua.edu.cn', port=443): Read timed out."))

还是和新问题一样。还以为是源的问题。

(pytorch) C:\Users\HP>conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/

(pytorch) C:\Users\HP>conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

(pytorch) C:\Users\HP>conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

(pytorch) C:\Users\HP>conda config --set show_channel_urls yes

(pytorch) C:\Users\HP>conda install pytorch=0.4.0
Collecting package metadata: failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/repodata.json>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
ConnectionError(ReadTimeoutError("HTTPSConnectionPool(host='mirrors.tuna.tsinghua.edu.cn', port=443): Read timed out."))

然后在查资料的时候,有人说pip比conda好用,随即尝试了一下。

(pytorch) C:\Users\HP>pip install pytorch=0.4.0
ERROR: Invalid requirement: 'pytorch=0.4.0'
= is not a valid operator. Did you mean == ?
WARNING: You are using pip version 19.1.1, however version 21.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

(pytorch) C:\Users\HP>pip install pytorch==0.4.0
Collecting pytorch==0.4.0
  ERROR: Could not find a version that satisfies the requirement pytorch==0.4.0 (from versions: 0.1.2, 1.0.2)
ERROR: No matching distribution found for pytorch==0.4.0
WARNING: You are using pip version 19.1.1, however version 21.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

(pip里pytorch叫torch,顺便把pip更新下, - -)

(pytorch) C:\Users\HP>python -m pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/cd/82/04e9aaf603fdbaecb4323b9e723f13c92c245f6ab2902195c53987848c78/pip-21.1.2-py3-none-any.whl (1.5MB)
     |████████████████████████████████| 1.6MB 504kB/s
Installing collected packages: pip
  Found existing installation: pip 19.1.1
    Uninstalling pip-19.1.1:
      Successfully uninstalled pip-19.1.1
Successfully installed pip-21.1.2

最后是把地址也直接放进去弄

(pytorch) C:\Users\HP>pip install torch==0.4.0 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
Collecting torch==0.4.0
  Downloading https://download.pytorch.org/whl/cu91/torch-0.4.0-cp36-cp36m-win_amd64.whl (607.0 MB)
     |████████████████████████████████| 607.0 MB 41 kB/s
Installing collected packages: torch
  Attempting uninstall: torch
    Found existing installation: torch 1.0.1
    Uninstalling torch-1.0.1:
      Successfully uninstalled torch-1.0.1
Successfully installed torch-0.4.0

小结

虽然程序跑起来,具体理论我不知道。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值