天天看点

conda创建虚拟环境失败创建新的虚拟环境,报错如下:解决方法:结果再一次报错:结果发现是自己命令输入错误,改正即可:

问题 解决方法 再遇问题 再次解决

创建新的虚拟环境,报错如下:

(base) [email protected]:~$ conda create -name R_env3.5 python=3.7 
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): failed

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

    Traceback (most recent call last):
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/core/subdir_data.py", line 375, in _load
        raw_repodata_str = fetch_repodata_remote_request(
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/core/subdir_data.py", line 815, 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/chen/miniconda3/lib/python3.8/site-packages/conda/exceptions.py", line 1079, in __call__
        return func(*args, **kwargs)
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/cli/main.py", line 84, in _main
        exit_code = do_call(args, p)
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/cli/conda_argparse.py", line 83, in do_call
        return getattr(module, func_name)(args, parser)
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/cli/main_create.py", line 41, in execute
        install(args, parser, 'create')
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/cli/install.py", line 261, in install
        unlink_link_transaction = solver.solve_for_transaction(
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/core/solve.py", line 114, in solve_for_transaction
        unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/core/solve.py", line 157, in solve_for_diff
        final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/core/solve.py", line 262, in solve_final_state
        ssc = self._collect_all_metadata(ssc)
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/common/io.py", line 88, in decorated
        return f(*args, **kwds)
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/core/solve.py", line 425, in _collect_all_metadata
        index, r = self._prepare(prepared_specs)
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/core/solve.py", line 1020, in _prepare
        reduced_index = get_reduced_index(self.prefix, self.channels,
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/core/index.py", line 288, in get_reduced_index
        new_records = SubdirData.query_all(spec, channels=channels, subdirs=subdirs,
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/core/subdir_data.py", line 140, in query_all
        result = tuple(concat(executor.map(subdir_query, channel_urls)))
      File "/home/chen/miniconda3/lib/python3.8/concurrent/futures/_base.py", line 611, in result_iterator
        yield fs.pop().result()
      File "/home/chen/miniconda3/lib/python3.8/concurrent/futures/_base.py", line 432, in result
        return self.__get_result()
      File "/home/chen/miniconda3/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
        raise self._exception
      File "/home/chen/miniconda3/lib/python3.8/concurrent/futures/thread.py", line 57, in run
        result = self.fn(*self.args, **self.kwargs)
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/core/subdir_data.py", line 132, in <lambda>
        subdir_query = lambda url: tuple(SubdirData(Channel(url), repodata_fn=repodata_fn).query(
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/core/subdir_data.py", line 145, in query
        self.load()
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/core/subdir_data.py", line 210, in load
        _internal_state = self._load()
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/core/subdir_data.py", line 393, in _load
        _internal_state = self._read_local_repdata(mod_etag_headers.get('_etag'),
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/core/subdir_data.py", line 442, in _read_local_repdata
        _internal_state = self._process_raw_repodata_str(raw_repodata_str)
      File "/home/chen/miniconda3/lib/python3.8/site-packages/conda/core/subdir_data.py", line 480, in _process_raw_repodata_str
        json_obj = json.loads(raw_repodata_str or '{}')
      File "/home/chen/miniconda3/lib/python3.8/json/__init__.py", line 357, in loads
        return _default_decoder.decode(s)
      File "/home/chen/miniconda3/lib/python3.8/json/decoder.py", line 337, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "/home/chen/miniconda3/lib/python3.8/json/decoder.py", line 353, in raw_decode
        obj, end = self.scan_once(s, idx)
    json.decoder.JSONDecodeError: Unterminated string starting at: line 1306937 column 9 (char 38944593)

`$ /home/chen/miniconda3/bin/conda create -name R_env3.5 python=3.7`

  environment variables:
                 CIO_TEST=<not set>
        CONDA_DEFAULT_ENV=base
                CONDA_EXE=/home/chen/miniconda3/bin/conda
             CONDA_PREFIX=/home/chen/miniconda3
    CONDA_PROMPT_MODIFIER=(base)
         CONDA_PYTHON_EXE=/home/chen/miniconda3/bin/python
               CONDA_ROOT=/home/chen/miniconda3
              CONDA_SHLVL=1
           CURL_CA_BUNDLE=<not set>
                     PATH=/home/chenyx/miniconda3/bin:/home/chen/bin:/home/chen/.local/bin:/
                          home/chen/miniconda3/bin:/home/chenyx/miniconda3/condabin:/usr/local
                          /sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/loc
                          al/games:/snap/bin
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : base
    active env location : /home/chen/miniconda3
            shell level : 1
       user config file : /home/chen/.condarc
 populated config files : /home/chen/.condarc
          conda version : 4.10.3
    conda-build version : not installed
         python version : 3.8.5.final.0
       virtual packages : __cuda=10.2=0
                          __linux=4.4.0=0
                          __glibc=2.23=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/chen/miniconda3  (writable)
      conda av data dir : /home/chen/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/linux-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
                          https://conda.anaconda.org/bioconda/linux-64
                          https://conda.anaconda.org/bioconda/noarch
                          https://conda.anaconda.org/r/linux-64
                          https://conda.anaconda.org/r/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /home/chenyx/miniconda3/pkgs
                          /home/chenyx/.conda/pkgs
       envs directories : /home/chenyx/miniconda3/envs
                          /home/chenyx/.conda/envs
               platform : linux-64
             user-agent : conda/4.10.3 requests/2.24.0 CPython/3.8.5 Linux/4.4.0-116-generic ubuntu/16.04.4 glibc/2.23
                UID:GID : 1010:1010
             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]: 
Timeout reached. No report sent.
           

解决方法:

明明昨天还好好的,今天就不行了,必然是因为我昨天疯狂加channel导致的。

直接恢复默认源:

conda config --remove-key channels
           

结果再一次报错:

(base) [email protected]:~$ conda create -name R_env3.5 python=3.7 
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - r_env3.5

Current channels:

  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.
           

结果发现是自己命令输入错误,改正即可:

conda create -n R_env3 python=3.7