conda create虚拟环境报错

报错内容:

Collecting package metadata (current_repodata.json): failed

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

    Traceback (most recent call last):
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 719, in fetch_repodata_remote_request
        resp.raise_for_status()
      File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
        raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch/current_repodata.json
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/exceptions.py", line 1125, in __call__
        return func(*args, **kwargs)
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/cli/main.py", line 86, in main_subshell
        exit_code = do_call(args, p)
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/cli/conda_argparse.py", line 93, in do_call
        return getattr(module, func_name)(args, parser)
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/notices/core.py", line 72, in wrapper
        return_value = func(*args, **kwargs)
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/cli/main_create.py", line 43, in execute
        install(args, parser, 'create')
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/cli/install.py", line 260, in install
        should_retry_solve=(_should_retry_unfrozen or repodata_fn != repodata_fns[-1]),
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/core/solve.py", line 155, in solve_for_transaction
        should_retry_solve)
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/core/solve.py", line 196, in solve_for_diff
        force_remove, should_retry_solve)
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/core/solve.py", line 300, in solve_final_state
        ssc = self._collect_all_metadata(ssc)
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/common/io.py", line 86, in decorated
        return f(*args, **kwds)
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/core/solve.py", line 463, in _collect_all_metadata
        index, r = self._prepare(prepared_specs)
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/core/solve.py", line 1058, in _prepare
        self.subdirs, prepared_specs, self._repodata_fn)
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/core/index.py", line 298, in get_reduced_index
        repodata_fn=repodata_fn)
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 152, in query_all
        result = tuple(concat(executor.map(subdir_query, channel_urls)))
      File "/home/tuolong/anaconda3/lib/python3.7/concurrent/futures/_base.py", line 586, in result_iterator
        yield fs.pop().result()
      File "/home/tuolong/anaconda3/lib/python3.7/concurrent/futures/_base.py", line 425, in result
        return self.__get_result()
      File "/home/tuolong/anaconda3/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
        raise self._exception
      File "/home/tuolong/anaconda3/lib/python3.7/concurrent/futures/thread.py", line 57, in run
        result = self.fn(*self.args, **self.kwargs)
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 145, in 
        package_ref_or_match_spec))
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 157, in query
        self.load()
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 222, in load
        _internal_state = self._load()
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 391, in _load
        repodata_fn=self.repodata_fn)
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/core/subdir_data.py", line 778, in fetch_repodata_remote_request
        response=e.response,
      File "/home/tuolong/anaconda3/lib/python3.7/site-packages/conda/exceptions.py", line 460, in __init__
        body = response.json()
      File "/usr/lib/python3/dist-packages/requests/models.py", line 897, in json
        return complexjson.loads(self.text, **kwargs)
      File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 518, in loads
        return _default_decoder.decode(s)
      File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
        obj, end = self.raw_decode(s)
      File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode
        return self.scan_once(s, idx=_w(s, idx).end())
      File "/usr/lib/python3/dist-packages/simplejson/scanner.py", line 79, in scan_once
        return _scan_once(string, idx)
      File "/usr/lib/python3/dist-packages/simplejson/scanner.py", line 70, in _scan_once
        raise JSONDecodeError(errmsg, string, idx)
    simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

`$ /home/tuolong/anaconda3/bin/conda create -n yolov7 python=3.7`

  environment variables:
                 CIO_TEST=
        CMAKE_PREFIX_PATH=/opt/ros/noetic
        CONDA_DEFAULT_ENV=base
                CONDA_EXE=/home/tuolong/anaconda3/bin/conda
             CONDA_PREFIX=/home/tuolong/anaconda3
    CONDA_PROMPT_MODIFIER=(base)
         CONDA_PYTHON_EXE=/home/tuolong/anaconda3/bin/python
               CONDA_ROOT=/home/tuolong/anaconda3
              CONDA_SHLVL=1
           CURL_CA_BUNDLE=
          LD_LIBRARY_PATH=/opt/ros/noetic/lib:/home/tuolong/freenect2/lib:/usr/local/cuda-11.2/l
                          ib64
                     PATH=/home/tuolong/anaconda3/bin:/home/tuolong/anaconda3/bin:/home/tuolong/
                          anaconda3/condabin:/opt/ros/noetic/bin:/home/tuolong/freenect2/lib/cma
                          ke/freenect2:/usr/local/cuda-11.2/bin:/home/tuolong/anaconda3/bin:/hom
                          e/tuolong/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
                          :/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
          PKG_CONFIG_PATH=/opt/ros/noetic/lib/pkgconfig
               PYTHONPATH=/opt/ros/noetic/lib/python3/dist-packages:/usr/lib/python3/dist-
                          packages
       REQUESTS_CA_BUNDLE=
         ROS_PACKAGE_PATH=/opt/ros/noetic/share
            SSL_CERT_FILE=
               WINDOWPATH=2

     active environment : base
    active env location : /home/tuolong/anaconda3
            shell level : 1
       user config file : /home/tuolong/.condarc
 populated config files : /home/tuolong/.condarc
          conda version : 4.14.0
    conda-build version : not installed
         python version : 3.7.0.final.0
       virtual packages : __cuda=11.6=0
                          __linux=5.15.0=0
                          __glibc=2.31=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/tuolong/anaconda3  (writable)
      conda av data dir : /home/tuolong/anaconda3/etc/conda
  conda av metadata url : None
           channel URLs : 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/cloud//pytorch/linux-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud//pytorch/noarch
                          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/pkgs/free/linux-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/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
          package cache : /home/tuolong/anaconda3/pkgs
                          /home/tuolong/.conda/pkgs
       envs directories : /home/tuolong/anaconda3/envs
                          /home/tuolong/.conda/envs
               platform : linux-64
             user-agent : conda/4.14.0 requests/2.22.0 CPython/3.7.0 Linux/5.15.0-69-generic ubuntu/20.04.6 glibc/2.31
                UID:GID : 1000:1000
             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 create虚拟环境报错_第1张图片

解决办法

#step1: 删除原有镜像
(base) tuolong@tuolong-20:~/anaconda3/envs$ conda config --remove-key channels
#step2: 添加默认镜像
(base) tuolong@tuolong-20:~/anaconda3/envs$ conda config --append channels conda-forge --append channels bioconda --append channels defaults

参考:

CondaHTTPError: HTTP 404 NOT FOUND for url https://pypi.tuna.tsinghua.edu.cn/simple/ 错误

你可能感兴趣的:(环境/软件安装,conda,python,开发语言)