ubuntu 20.04 Conda 创建环境出错:Collecting package metadata (current_repodata.json): failed

本文详细介绍了在Ubuntu 20.04系统上遇到的Python3.8创建环境问题,提供了通过修改~/.condarc来切换Anaconda源,清理缓存,创建numpy环境,设置代理,调整频道优先级等步骤。重点在于解决conda源问题和环境配置技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.问题

在创建python环境的时候出现这个问题。有人说是conda版本太新?
环境:
ubuntu 20.04
Anaconda - Python 3.8

2.解决办法

1.修改~/.condarc,两个都可以
清华源(优先支持ipv4)

auto_activate_base: false
ssl_verify: true
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
show_channel_urls: true

中科大源(建议使用,优先支持ipv6)

auto_activate_base: false
ssl_verify: true
channels:
  - https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
  - https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
show_channel_urls: true
channel_priority: flexible

2.清除缓存

conda clean -i

3.创建一个名为numpypython3.8环境

conda create -n numpy python=3.8

4.考虑代理
5.设置channel_priority1

conda config --set channel_priority flexible

6.conda env create -f pytorch17.yaml
使用这个简历环境,注意去除pytorch17.yaml中channel的部分。使用系统channel。
7.pytorch安装
conda添加清华的pytorch channel:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

  1. https://blog.csdn.net/dou3516/article/details/107601256 ↩︎

zc@ubuntu:/data/TeamMember/zcl/zc/td$ conda create -n sa3d python=3.10 /data/software/anaconda3/lib/python3.12/site-packages/conda/base/context.py:198: FutureWarning: Adding 'defaults' to channel list implicitly is deprecated and will be removed in 25.3. To remove this warning, please choose a default channel explicitly with conda's regular configuration system, e.g. by adding 'defaults' to the list of channels: conda config --add channels defaults For more information see https://docs.conda.io/projects/conda/en/stable/user-guide/configuration/use-condarc.html deprecated.topic( Channels: - defaults Platform: linux-64 Collecting package metadata (repodata.json): - WARNING conda.gateways.repodata.jlap.fetch:request_url_jlap_state(322): Could not decompress https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch/repodata.json.zst as zstd. Fall back to .json. (zstd decompress error: Unknown frame descriptor) \ WARNING conda.gateways.repodata.jlap.fetch:request_url_jlap_state(322): Could not decompress https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2/linux-64/repodata.json.zst as zstd. Fall back to .json. (zstd decompress error: Unknown frame descriptor| WARNING conda.gateways.repodata.jlap.fetch:request_url_jlap_state(322): Could not decompress https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/repodata.json.zst as zstd. Fall back to .json. (zstd decompress error: Unknown frame descriptor) WARNING conda.gateways.repodata.jlap.fetch:request_url_jlap_state(322): Could not decompress https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/noarch/repodata.json.zst as zstd. Fall back to .json. (zstd decompress error: Unknown frame descriptor) WARNING conda.gateways.repodata.jlap.fetch:request_url_jlap_state(322): Could not decompress https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/linux-64/repodata.json.zst as zstd. Fall back to .json. (zstd decompress error: Unknown frame descriptor) / WARNING conda.gateways.repodata.jlap.fetch:request_url_jlap_state(322): Could not decompress https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2/noarch/repodata.json.zst as zstd. Fall back to .json. (zstd decompress error: Unknown frame descriptor) failed /data/software/anaconda3/lib/python3.12/site-packages/conda/base/context.py:198: FutureWarning: Adding 'defaults' to channel list implicitly is deprecated and will be removed in 25.3. To remove this warning, please choose a default channel explicitly with conda's regular configuration system, e.g. by adding 'defaults' to the list of channels: conda config --add channels defaults For more information see https://docs.conda.io/projects/conda/en/stable/user-guide/configuration/use-condarc.html deprecated.topic( # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< Traceback (most recent call last): File "/data/software/anaconda3/lib/python3.12/site-packages/conda/exception_handler.py", line 18, in __call__ return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/site-packages/conda/cli/main.py", line 61, in main_subshell exit_code = do_call(args, parser) ^^^^^^^^^^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/site-packages/conda/cli/conda_argparse.py", line 205, in do_call result = getattr(module, func_name)(args, parser) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/site-packages/conda/notices/core.py", line 132, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/site-packages/conda/cli/main_create.py", line 154, in execute return install(args, parser, "create") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/site-packages/conda/cli/install.py", line 417, in install unlink_link_transaction = solver.solve_for_transaction( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/site-packages/conda/core/solve.py", line 152, in solve_for_transaction unlink_precs, link_precs = self.solve_for_diff( ^^^^^^^^^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/site-packages/conda/core/solve.py", line 221, in solve_for_diff final_precs = self.solve_final_state( ^^^^^^^^^^^^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/site-packages/conda_libmamba_solver/solver.py", line 231, in solve_final_state index = IndexHelper( ^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/site-packages/conda_libmamba_solver/index.py", line 136, in __init__ self._index = self._load_channels() ^^^^^^^^^^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/site-packages/conda_libmamba_solver/index.py", line 335, in _load_channels jsons = {url: str(path) for (url, path) in executor.map(self._fetch_channel, urls)} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/concurrent/futures/_base.py", line 619, in result_iterator yield _result_or_cancel(fs.pop()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/concurrent/futures/_base.py", line 317, in _result_or_cancel return fut.result(timeout) ^^^^^^^^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/concurrent/futures/_base.py", line 456, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/data/software/anaconda3/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/site-packages/conda_libmamba_solver/index.py", line 254, in _fetch_channel json_path, _ = subdir_data.repo_fetch.fetch_latest_path() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/site-packages/conda/gateways/repodata/__init__.py", line 749, in fetch_latest_path _, state = self.fetch_latest() ^^^^^^^^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/site-packages/conda/gateways/repodata/__init__.py", line 873, in fetch_latest raw_repodata = self.cache_path_json.read_text() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/software/anaconda3/lib/python3.12/pathlib.py", line 1028, in read_text return f.read() ^^^^^^^^ File "<frozen codecs>", line 322, in decode UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc9 in position 465: invalid continuation byte `$ /data/software/anaconda3/bin/conda create -n sa3d python=3.10` environment variables: CIO_TEST=<not set> CONDA_ALLOW_SOFTLINKS=false CONDA_DEFAULT_ENV=base CONDA_EXE=/data/software/anaconda3/bin/conda CONDA_PREFIX=/data/software/anaconda3 CONDA_PROMPT_MODIFIER=(base) CONDA_PYTHON_EXE=/data/software/anaconda3/bin/python CONDA_ROOT=/data/software/anaconda3 CONDA_SHLVL=1 CURL_CA_BUNDLE=<not set> LD_LIBRARY_PATH=:/usr/local/cuda-12.2/lib64 LD_PRELOAD=<not set> PATH=/data/software/anaconda3/bin:/data/software/anaconda3/condabin:/usr/lo cal/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/ local/games:/snap/bin:/usr/local/cuda-12.2/bin REQUESTS_CA_BUNDLE=<not set> SSL_CERT_FILE=<not set> active environment : base active env location : /data/software/anaconda3 shell level : 1 user config file : /home/zc/.condarc populated config files : /home/zc/.condarc conda version : 24.9.2 conda-build version : 24.9.0 python version : 3.12.7.final.0 solver : libmamba (default) virtual packages : __archspec=1=icelake __conda=24.9.2=0 __cuda=12.4=0 __glibc=2.31=0 __linux=5.4.0=0 __unix=0=0 base environment : /data/software/anaconda3 (read only) conda av data dir : /data/software/anaconda3/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/pkgs/r/linux-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/noarch https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2/linux-64 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2/noarch package cache : /data/software/anaconda3/pkgs /home/zc/.conda/pkgs envs directories : /data/TeamMember/zcl/zc/conda/envs /data/TeamMember/zcl/zc/.conda/envs /home/zc/.conda/envs /data/software/anaconda3/envs platform : linux-64 user-agent : conda/24.9.2 requests/2.32.3 CPython/3.12.7 Linux/5.4.0-144-generic ubuntu/20.04.6 glibc/2.31 solver/libmamba conda-libmamba-solver/24.9.0 libmambapy/1.5.8 aau/0.4.4 c/. s/. e/. UID:GID : 1004:0 netrc file : None offline mode : False An unexpected error has occurred. Conda has prepared the above report. If you suspect this error is being caused by a malfunctioning plugin, consider using the --no-plugins option to turn off plugins. Example: conda --no-plugins install <package> Alternatively, you can set the CONDA_NO_PLUGINS environment variable on the command line to run the command without plugins enabled. Example: CONDA_NO_PLUGINS=true conda install <package> 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 did not complete. 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 创建环境报错
最新发布
07-24
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

nachifur

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值