当前位置: 首页 > 工具软件 > fat32-lib > 使用案例 >

conda安装packages时报错File “C:\ProgramData\anaconda3\lib\site-packages\conda\core\subdir_data.py“

慕学海
2023-12-01

不知咋的,它又㕛叒报错了。。。
报错如下:

(base) PS C:\Users\Administrator> conda install shapely==1.7.1
Collecting package metadata (current_repodata.json): failed

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

    Traceback (most recent call last):
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 704, in fetch_repodata_remote_request
        resp.raise_for_status()
      File "C:\ProgramData\anaconda3\lib\site-packages\requests\models.py", line 960, in raise_for_status
        raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://mirrors.bfsu.edu.cn/anaconda/cloud/menpo/noarch/current_repodata.json

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\ProgramData\anaconda3\lib\site-packages\requests\models.py", line 910, in json
        return complexjson.loads(self.text, **kwargs)
      File "C:\ProgramData\anaconda3\lib\site-packages\simplejson\__init__.py", line 525, in loads
        return _default_decoder.decode(s)
      File "C:\ProgramData\anaconda3\lib\site-packages\simplejson\decoder.py", line 370, in decode
        obj, end = self.raw_decode(s)
      File "C:\ProgramData\anaconda3\lib\site-packages\simplejson\decoder.py", line 400, in raw_decode
        return self.scan_once(s, idx=_w(s, idx).end())
    simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\exceptions.py", line 1114, in __call__
        return func(*args, **kwargs)
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\cli\main.py", line 86, in main_subshell
        exit_code = do_call(args, p)
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 90, in do_call
        return getattr(module, func_name)(args, parser)
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\cli\main_install.py", line 20, in execute
        install(args, parser, 'install')
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\cli\install.py", line 259, in install
        unlink_link_transaction = solver.solve_for_transaction(
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\core\solve.py", line 152, in solve_for_transaction
        unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\core\solve.py", line 195, in solve_for_diff
        final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\core\solve.py", line 300, in solve_final_state
        ssc = self._collect_all_metadata(ssc)
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\common\io.py", line 86, in decorated
        return f(*args, **kwds)
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\core\solve.py", line 463, in _collect_all_metadata
        index, r = self._prepare(prepared_specs)
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\core\solve.py", line 1058, in _prepare
        reduced_index = get_reduced_index(self.prefix, self.channels,
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\core\index.py", line 287, in get_reduced_index
        new_records = SubdirData.query_all(spec, channels=channels, subdirs=subdirs,
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 139, in query_all
        result = tuple(concat(executor.map(subdir_query, channel_urls)))
      File "C:\ProgramData\anaconda3\lib\concurrent\futures\_base.py", line 609, in result_iterator
        yield fs.pop().result()
      File "C:\ProgramData\anaconda3\lib\concurrent\futures\_base.py", line 439, in result
        return self.__get_result()
      File "C:\ProgramData\anaconda3\lib\concurrent\futures\_base.py", line 391, in __get_result
        raise self._exception
      File "C:\ProgramData\anaconda3\lib\concurrent\futures\thread.py", line 58, in run
        result = self.fn(*self.args, **self.kwargs)
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 131, in <lambda>
        subdir_query = lambda url: tuple(SubdirData(Channel(url), repodata_fn=repodata_fn).query(
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 144, in query
        self.load()
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 209, in load
        _internal_state = self._load()
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 374, in _load
        raw_repodata_str = fetch_repodata_remote_request(
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 735, in fetch_repodata_remote_request
        raise UnavailableInvalidChannel(
      File "C:\ProgramData\anaconda3\lib\site-packages\conda\exceptions.py", line 460, in __init__
        body = response.json()
      File "C:\ProgramData\anaconda3\lib\site-packages\requests\models.py", line 917, in json
        raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
    requests.exceptions.JSONDecodeError: [Errno Expecting value] <html>
    <head><title>404 Not Found</title></head>
    <body bgcolor="white">
    <center><h1>404 Not Found</h1></center>
    <hr><center>nginx/1.14.2</center>
    </body>
    </html>
    : 0

`$ C:\ProgramData\anaconda3\Scripts\conda-script.py install shapely==1.7.1`

  environment variables:
                 CIO_TEST=<not set>
                CLASSPATH=.;C:\Program Files\Java\jdk-17\lib\dt.jar;C:\Program
                          Files\Java\jdk-17\lib\tools.jar
        CONDA_DEFAULT_ENV=base
                CONDA_EXE=C:\ProgramData\anaconda3\Scripts\conda.exe
             CONDA_PREFIX=C:\ProgramData\anaconda3
    CONDA_PROMPT_MODIFIER=(base)
         CONDA_PYTHON_EXE=C:\ProgramData\anaconda3\python.exe
               CONDA_ROOT=C:\ProgramData\anaconda3
              CONDA_SHLVL=1
                CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1
           CURL_CA_BUNDLE=<not set>
                 HOMEPATH=\Users\Administrator
          LD_LIBRARY_PATH=C:ProgramDataHEGTools\HEG_Win\bin
          MOZ_PLUGIN_PATH=C:\PROGRAM FILES (X86)\FOXIT SOFTWARE\FOXIT PHANTOM\plugins\
          NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt\
                     PATH=C:\ProgramData\anaconda3;C:\ProgramData\anaconda3\Library\mingw-w64\bi
                          n;C:\ProgramData\anaconda3\Library\usr\bin;C:\ProgramData\anaconda3\Li
                          brary\bin;C:\ProgramData\anaconda3\Scripts;C:\ProgramData\anaconda3\bi
                          n;C:\ProgramData\anaconda3;C:\ProgramData\anaconda3\Library\mingw-w64\
                          bin;C:\ProgramData\anaconda3\Library\usr\bin;C:\ProgramData\anaconda3\
                          Library\bin;C:\ProgramData\anaconda3\Scripts;C:\ProgramData\anaconda3\
                          bin;C:\ProgramData\anaconda3\condabin;C:\Users\Administrator\anaconda3
                          ;C:\Users\Administrator\anaconda3\Scripts;C:\Users\Administrator\anaco
                          nda3\Library\bin;C:\Users\Administrator\anaconda3\Library\mingw-w64\bi
                          n;C:\Users\Administrator\anaconda3\pkgs;C:\Program
                          Files\dotnet;C:\Program Files\Microsoft SQL
                          Server\130\Tools\Binn;C:\Program Files\NVIDIA Corporation\Nsight
                          Compute 2020.2.1;C:\Program Files\Java\jdk-17\bin;C:\Program
                          Files\Java\jdk-17\jre\bin;D:\Python27\ArcGIS10.5;C:\Program Files\node
                          js;C:\ProgramData\chocolatey\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WIN
                          DOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDO
                          WS\System32\OpenSSH;C:\Users\Administrator\AppData\Roaming\Python\Pyth
                          on39\Scripts;C:\Program Files\Git\cmd;.;c:\HEGtools\HEG_Win\bin
             PSMODULEPATH=C:\Users\Administrator\Documents\WindowsPowerShell\Modules;C:\Program
                          Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\
                          v1.0\Modules
               PYTHONPATH=D:\ProgramData\Anaconda3;D:\Python27\ArcGIS10.5
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : base
    active env location : C:\ProgramData\anaconda3
            shell level : 1
       user config file : C:\Users\Administrator\.condarc
 populated config files : C:\Users\Administrator\.condarc
          conda version : 4.13.0
    conda-build version : 3.21.9
         python version : 3.9.12.final.0
       virtual packages : __cuda=11.6=0
                          __win=0=0
                          __archspec=1=x86_64
       base environment : C:\ProgramData\anaconda3  (writable)
      conda av data dir : C:\ProgramData\anaconda3\etc\conda
  conda av metadata url : None
           channel URLs : https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/win-64
                          https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/noarch
                          https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/win-64
                          https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/noarch
                          https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/win-64
                          https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/noarch
                          https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/win-64
                          https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/noarch
                          https://mirrors.ustc.edu.cn/anaconda/pkgs/free/win-64
                          https://mirrors.ustc.edu.cn/anaconda/pkgs/free/noarch
                          https://mirrors.ustc.edu.cn/anaconda/pkgs/main/win-64
                          https://mirrors.ustc.edu.cn/anaconda/pkgs/main/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 : C:\ProgramData\anaconda3\pkgs
                          C:\Users\Administrator\.conda\pkgs
                          C:\Users\Administrator\AppData\Local\conda\conda\pkgs
       envs directories : C:\ProgramData\anaconda3\envs
                          C:\Users\Administrator\.conda\envs
                          C:\Users\Administrator\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.13.0 requests/2.27.1 CPython/3.9.12 Windows/10 Windows/10.0.19044
          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]: n

No report sent. To permanently opt-out, use

    $ conda config --set report_errors false

可以看到报错是显示HTTP请求404,应该是镜像源的问题。
HTTPError: 404 Client Error: Not Found for url: https://mirrors.bfsu.edu.cn/anaconda/cloud/menpo/noarch/current_repodata.json

恢复一下默认源试试:
conda config --remove-key channels
查看现在源:
conda config --show channels

channels:
  - defaults

没问题,然后再尝试安装包,

(base) PS C:\Users\Administrator> conda install shapely
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\ProgramData\anaconda3

  added / updated specs:
    - shapely


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    openssl-1.1.1n             |       h2bbff1b_0         4.8 MB
    ------------------------------------------------------------
                                           Total:         4.8 MB

The following NEW packages will be INSTALLED:

  geos               pkgs/main/win-64::geos-3.8.0-h33f27b4_0
  shapely            pkgs/main/win-64::shapely-1.7.1-py39h06580b3_0

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

  ca-certificates                        anaconda/pkgs/main --> pkgs/main
  certifi                                anaconda/pkgs/main --> pkgs/main
  conda              anaconda/cloud/conda-forge::conda-4.1~ --> pkgs/main::conda-4.13.0-py39haa95532_0
  openssl                                anaconda/pkgs/main --> pkgs/main


Proceed ([y]/n)? y


Downloading and Extracting Packages
openssl-1.1.1n       | 4.8 MB    | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

没什么报错,ok。
打开jupyter notebook,导入包
from shapely.geometry import Polygon
ok,没有报错,问题解决!!!

 类似资料: