项目需求python版本大于3.10,尝试把已有anaconda python版本从3.9升级到python3.12,运行conda install python==3.12时报错:

 (test) root@ailink:/home/ailink/LLM/SafePlates-main# conda install python==3.12
 
Retrieving notices: ...working... ERROR conda.notices.fetch:get_channel_notice_response(68): Request error <Failed to parse: https://your-proxy-server:port> for channel: anaconda/pkgs/main url: https://anaconda/pkgs/main/notices.json
ERROR conda.notices.fetch:get_channel_notice_response(68): Request error <Failed to parse: https://your-proxy-server:port> for channel: anaconda/pkgs/free url: https://mirrors.ustc.edu.cn/anaconda/pkgs/
ERROR conda.notices.fetch:get_channel_notice_response(68): Request error <Failed to parse: https://your-proxy-server:port> for channel: defaults url: https://repo.anaconda.com/pkgs/main/notices.json
ERROR conda.notices.fetch:get_channel_notice_response(68): Request error <Failed to parse: https://your-proxy-server:port> for channel: defaults url: https://repo.anaconda.com/pkgs/r/notices.json
done
Collecting package metadata (current_repodata.json): failed

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

    Traceback (most recent call last):
      File "/root/anaconda3/lib/python3.11/site-packages/requests/adapters.py", line 633, in send
        conn = self.get_connection_with_tls_context(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/root/anaconda3/lib/python3.11/site-packages/requests/adapters.py", line 476, in get_connection_with_tls_context
        proxy = prepend_scheme_if_needed(proxy, "http")
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/root/anaconda3/lib/python3.11/site-packages/requests/utils.py", line 995, in prepend_scheme_if_needed
        parsed = parse_url(url)
                 ^^^^^^^^^^^^^^
      File "/root/anaconda3/lib/python3.11/site-packages/urllib3/util/url.py", line 397, in parse_url
        return six.raise_from(LocationParseError(source_url), None)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "<string>", line 3, in raise_from
    urllib3.exceptions.LocationParseError: Failed to parse: https://your-proxy-server:port


可以观察到,错误信息分为两部分,第一部分是Retrieving notices,第二部分是ERROR REPORT ,解决:
1、清理缓存
Conda 的缓存可能导致解析问题,尝试先清理缓存:

(test) root@ailink:/home/ailink/LLM/SafePlates-main# conda clean --all
Will remove 518 (1.07 GB) tarball(s).

Proceed ([y]/n)? y

Will remove 1 index cache(s).
Proceed ([y]/n)? y

Will remove 565 (4.68 GB) package(s).
Proceed ([y]/n)? y

There are no tempfile(s) to remove.
There are no logfile(s) to remove.

2、再次安装python3.12


(test) root@ailink:/home/ailink/LLM/SafePlates-main# conda install python==3.12
Collecting package metadata (current_repodata.json): failed

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

    Traceback (most recent call last):
      File "/root/anaconda3/lib/python3.11/site-packages/requests/adapters.py", line 633, in send
        conn = self.get_connection_with_tls_context(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/root/anaconda3/lib/python3.11/site-packages/requests/adapters.py", line 476, in get_connection_with_tls_context
        proxy = prepend_scheme_if_needed(proxy, "http")
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/root/anaconda3/lib/python3.11/site-packages/requests/utils.py", line 995, in prepend_scheme_if_needed
        parsed = parse_url(url)
                 ^^^^^^^^^^^^^^
      File "/root/anaconda3/lib/python3.11/site-packages/urllib3/util/url.py", line 397, in parse_url
        return six.raise_from(LocationParseError(source_url), None)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "<string>", line 3, in raise_from
    urllib3.exceptions.LocationParseError: Failed to parse: https://your-proxy-server:port


3、临时清理代理信息
可以观察到清楚缓存后Retrieving notices错误不再输出,但ERROR REPORT部分仍报错,且报错信息认为代理地址出错,尝试临时清除代理

(test) root@ailink:/home/ailink/LLM/SafePlates-main# conda config --remove-key proxy_servers.http

4、再次安装,成功升级python


(test) root@ailink:/home/ailink/LLM/SafePlates-main# conda install python==3.12
Collecting package metadata (current_repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 23.7.4
  latest version: 25.3.1

Please update conda by running

    $ conda update -n base -c defaults conda

Or to minimize the number of packages updated during conda update use

     conda install conda=25.3.1



## Package Plan ##

  environment location: /root/anaconda3/envs/test

  added / updated specs:
    - python==3.12


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ca-certificates-2025.2.25  |       h06a4308_0         129 KB  https://mirrors.ustc.edu.cn/anaconda/pkgs/main
    expat-2.6.4                |       h6a678d5_0         180 KB  https://mirrors.ustc.edu.cn/anaconda/pkgs/main
    libstdcxx-ng-11.2.0        |       h1234567_1         4.7 MB  https://mirrors.ustc.edu.cn/anaconda/pkgs/main
    libuuid-1.41.5             |       h5eee18b_0          27 KB  https://mirrors.ustc.edu.cn/anaconda/pkgs/main
    python-3.12.0              |       h996f2a0_0        35.0 MB  https://mirrors.ustc.edu.cn/anaconda/pkgs/main
    sqlite-3.45.3              |       h5eee18b_0         1.2 MB  https://mirrors.ustc.edu.cn/anaconda/pkgs/main
    tk-8.6.14                  |       h39e8969_0         3.4 MB  https://mirrors.ustc.edu.cn/anaconda/pkgs/main
    xz-5.6.4                   |       h5eee18b_1         567 KB  https://mirrors.ustc.edu.cn/anaconda/pkgs/main
    zlib-1.2.13                |       h5eee18b_1         111 KB  https://mirrors.ustc.edu.cn/anaconda/pkgs/main
    ------------------------------------------------------------
                                           Total:        45.3 MB

The following NEW packages will be INSTALLED:

  expat              anaconda/pkgs/main/linux-64::expat-2.6.4-h6a678d5_0
  libstdcxx-ng       anaconda/pkgs/main/linux-64::libstdcxx-ng-11.2.0-h1234567_1
  sqlite             anaconda/pkgs/main/linux-64::sqlite-3.45.3-h5eee18b_0
  zlib               anaconda/pkgs/main/linux-64::zlib-1.2.13-h5eee18b_1

The following packages will be REMOVED:

  libsqlite-3.46.0-hde9e2c9_0
  libzlib-1.3.1-h4ab18f5_1

The following packages will be UPDATED:

  ca-certificates    anaconda/cloud/conda-forge::ca-certif~ --> anaconda/pkgs/main::ca-certificates-2025.2.25-h06a4308_0
  python             anaconda/cloud/conda-forge::python-3.~ --> anaconda/pkgs/main::python-3.12.0-h996f2a0_0
  tk                 anaconda/cloud/conda-forge::tk-8.6.13~ --> anaconda/pkgs/main::tk-8.6.14-h39e8969_0
  xz                 anaconda/cloud/conda-forge::xz-5.2.6-~ --> anaconda/pkgs/main::xz-5.6.4-h5eee18b_1

The following packages will be SUPERSEDED by a higher-priority channel:

  libuuid            anaconda/cloud/conda-forge::libuuid-2~ --> anaconda/pkgs/main::libuuid-1.41.5-h5eee18b_0


Proceed ([y]/n)? y


Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐