anaconda环境配置中的问题Collectingpackagemetadata(current_repodata.json): failedjson.decoder.JSONDecodeError

anaconda环境配置中的问题

关键词:创建环境、conda create、

问题描述:我想使用conda create命令创建一个新的环境,可是一直在报如下的错误;
简介的说是Collecting package metadata (current_repodata.json): failed······json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 41 (char 40)

(base) C:\Users\SUNX>conda create -n pytorch python=3.9
Collecting package metadata (current_repodata.json): failed

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

    Traceback (most recent call last):
      File "D:\Tool\Anaconda3\lib\site-packages\conda\exceptions.py", line 1082, in __call__
        return func(*args, **kwargs)
      File "D:\Tool\Anaconda3\lib\site-packages\conda\cli\main.py", line 87, in _main
        exit_code = do_call(args, p)
      File "D:\Tool\Anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 84, in do_call
        return getattr(module, func_name)(args, parser)
      File "D:\Tool\Anaconda3\lib\site-packages\conda\cli\main_create.py", line 41, in execute
        install(args, parser, 'create')
      File "D:\Tool\Anaconda3\lib\site-packages\conda\cli\install.py", line 260, in install
        unlink_link_transaction = solver.solve_for_transaction(
      File "D:\Tool\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 "D:\Tool\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 "D:\Tool\Anaconda3\lib\site-packages\conda\core\solve.py", line 300, in solve_final_state
        ssc = self._collect_all_metadata(ssc)
      File "D:\Tool\Anaconda3\lib\site-packages\conda\common\io.py", line 88, in decorated
        return f(*args, **kwds)
      File "D:\Tool\Anaconda3\lib\site-packages\conda\core\solve.py", line 463, in _collect_all_metadata
        index, r = self._prepare(prepared_specs)
      File "D:\Tool\Anaconda3\lib\site-packages\conda\core\solve.py", line 1058, in _prepare
        reduced_index = get_reduced_index(self.prefix, self.channels,
      File "D:\Tool\Anaconda3\lib\site-packages\conda\core\index.py", line 288, in get_reduced_index
        new_records = SubdirData.query_all(spec, channels=channels, subdirs=subdirs,
      File "D:\Tool\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 140, in query_all
        result = tuple(concat(executor.map(subdir_query, channel_urls)))
      File "D:\Tool\Anaconda3\lib\concurrent\futures\_base.py", line 609, in result_iterator
        yield fs.pop().result()
      File "D:\Tool\Anaconda3\lib\concurrent\futures\_base.py", line 439, in result
        return self.__get_result()
      File "D:\Tool\Anaconda3\lib\concurrent\futures\_base.py", line 391, in __get_result
        raise self._exception
      File "D:\Tool\Anaconda3\lib\concurrent\futures\thread.py", line 58, in run
        result = self.fn(*self.args, **self.kwargs)
      File "D:\Tool\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 132, in 
        subdir_query = lambda url: tuple(SubdirData(Channel(url), repodata_fn=repodata_fn).query(
      File "D:\Tool\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 145, in query
        self.load()
      File "D:\Tool\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 210, in load
        _internal_state = self._load()
      File "D:\Tool\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 407, in _load
        _internal_state = self._process_raw_repodata_str(raw_repodata_str)
      File "D:\Tool\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 480, in _process_raw_repodata_str
        json_obj = json.loads(raw_repodata_str or '{}')
      File "D:\Tool\Anaconda3\lib\json\__init__.py", line 346, in loads
        return _default_decoder.decode(s)
      File "D:\Tool\Anaconda3\lib\json\decoder.py", line 337, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "D:\Tool\Anaconda3\lib\json\decoder.py", line 353, in raw_decode
        obj, end = self.scan_once(s, idx)
    json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 41 (char 40)

`$ D:\Tool\Anaconda3\Scripts\conda-script.py create -n pytorch python=3.9`

  environment variables:
                 CIO_TEST=
        CONDA_DEFAULT_ENV=base
                CONDA_EXE=D:\Tool\Anaconda3\condabin\..\Scripts\conda.exe
               CONDA_EXES="D:\Tool\Anaconda3\condabin\..\Scripts\conda.exe"
             CONDA_PREFIX=D:\Tool\Anaconda3
    CONDA_PROMPT_MODIFIER=(base)
         CONDA_PYTHON_EXE=D:\Tool\Anaconda3\python.exe
               CONDA_ROOT=D:\Tool\Anaconda3
              CONDA_SHLVL=1
            CUDA_BIN_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\bin
            CUDA_LIB_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\lib\x64
                CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6
        CUDA_SDK_BIN_PATH=C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.6\bin\win64
        CUDA_SDK_LIB_PATH=C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.6\common\lib\x64
            CUDA_SDK_PATH=C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.6
           CURL_CA_BUNDLE=
                 HOMEPATH=\Users\SUNX
          NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt\
                     PATH=D:\Tool\Anaconda3;D:\Tool\Anaconda3\Library\mingw-w64\bin;D:\Tool\Anac
                          onda3\Library\usr\bin;D:\Tool\Anaconda3\Library\bin;D:\Tool\Anaconda3\
                          Scripts;D:\Tool\Anaconda3\bin;D:\Tool\Anaconda3;D:\Tool\Anaconda3\Libr
                          ary\mingw-w64\bin;D:\Tool\Anaconda3\Library\usr\bin;D:\Tool\Anaconda3\
                          Library\bin;D:\Tool\Anaconda3\Scripts;D:\Tool\Anaconda3\bin;D:\Tool\An
                          aconda3\condabin;C:\Program Files\NVIDIA GPU Computing
                          Toolkit\CUDA\v11.6\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\C
                          UDA\v11.6\libnvvp;C:\Windows\system32;C:\Windows;C:\Windows\System32\W
                          bem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\Ope
                          nSSH;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program
                          Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program
                          Files\nodejs;C:\ProgramData\chocolatey\bin;C:\Program Files
                          (x86)\Prince\engine\bin;C:\Program Files\NVIDIA Corporation\Nsight
                          Compute 2022.1.0;D:\Tool\Anaconda3;D:\Tool\Anaconda3\Library\mingw-w64
                          \bin;D:\Tool\Anaconda3\Library\usr\bin;D:\Tool\Anaconda3\Library\bin;D
                          :\Tool\Anaconda3\Scripts;C:\Windows\system32;C:\Users\SUNX\AppData\Loc
                          al\Programs\Python\Python39\Scripts;C:\Users\SUNX\AppData\Local\Progra
                          ms\Python\Python39;C:\Users\SUNX\AppData\Local\Microsoft\WindowsApps;C
                          :\Program Files\JetBrains\PyCharm Community Edition
                          2022.1.2\bin;C:\Program Files\JetBrains\IntelliJ IDEA Community
                          Edition 2021.3.2\bin;C:\Users\SUNX\AppData\Local\Programs\Microsoft VS
                          Code\bin;C:\Users\SUNX\AppData\Roaming\npm;C:\Users\SUNX\AppData\Local
                          \atom\bin
             PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\Windows
                          PowerShell\v1.0\Modules
       REQUESTS_CA_BUNDLE=
            SSL_CERT_FILE=

     active environment : base
    active env location : D:\Tool\Anaconda3
            shell level : 1
       user config file : C:\Users\SUNX\.condarc
 populated config files : C:\Users\SUNX\.condarc
          conda version : 4.12.0
    conda-build version : 3.21.8
         python version : 3.9.12.final.0
       virtual packages : __cuda=11.7=0
                          __win=0=0
                          __archspec=1=x86_64
       base environment : D:\Tool\Anaconda3  (writable)
      conda av data dir : D:\Tool\Anaconda3\etc\conda
  conda av metadata url : None
           channel URLs : https://anaconda.org/win-64
                          https://anaconda.org/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 : D:\Tool\Anaconda3\pkgs
                          C:\Users\SUNX\.conda\pkgs
                          C:\Users\SUNX\AppData\Local\conda\conda\pkgs
       envs directories : D:\Tool\Anaconda3\envs
                          C:\Users\SUNX\.conda\envs
                          C:\Users\SUNX\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.12.0 requests/2.27.1 CPython/3.9.12 Windows/10 Windows/10.0.22000
          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?

这里给出一些解决方案。
1.可以首先尝试执行
conda clean -i
删除一些缓存,但是尝试之后没有成功。
2.删除.condarc文件
conda config --show-sources
通过该命令找到.condarc文件的位置,并进行删除。通常来说,.condrac文件存在在用户的家目录下(C:\users\username\),并且是一个隐藏文件。
将其删除后,重新执行conda create命令可以成功。
参考:https://stackoverflow.com/questions/61134985/conda-install-packages-error-collecting-package-metadata-current-repodata-json/61147979#61147979

你可能感兴趣的:(Python,原创,json,python,深度学习,anaconda)