问题

使用python部署独立环境小伙伴因为网速慢没少吃苦。下面的异常你一定见过,或者似曾相识

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/linux-64/qt-5.12.5-hd8c4c69_1.tar.bz2>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.


Collecting package metadata (current_repodata.json): failed

 

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/conda-forge/linux-64/current_repodata.json>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
'https://conda.anaconda.org/conda-forge/linux-64'

我就想好好的安装环境,干嘛让我吃闭门羹。

解决方法

Anaconda下载速度很慢,笔者换了Miniconda速度稍微好一些。但是一些资源minconda还是下载不到。经过最终寻找,笔者在清华大学镜像网站上找到设置中国镜像源的版本如下:

#1、备份本地配置 
cp ~/.condarc ~/.condarc.bak

vim ~/.condarc
#2、删除原来的内容,填入以下
channels:
  - defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud



#3、清除缓存
conda clean -i 

结果

再次安装依赖包即成功,日志如下

(myenv) ubuntu@ubuntu:~$ conda install librosa -c conda-forge
Collecting package metadata (current_repodata.json): done
Solving environment: \ 
Warning: >10 possible package resolutions (only showing differing packages):
  - https://repo.anaconda.com/pkgs/main/linux-64/linux-64::_tflow_select-2.1.0-gpu, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::absl-py-0.9.0-py36_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::libgfortran-ng-7.3.0-hdf63c60_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::libprotobuf-3.11.4-hd408876_0
  - defaults/linux-64::libgfortran-ng-7.3.0-hdf63c60_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::_tflow_select-2.1.0-gpu, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::absl-py-0.9.0-py36_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::libprotobuf-3.11.4-hd408876_0
  - defaults/linux-64::libprotobuf-3.11.4-hd408876_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::_tflow_select-2.1.0-gpu, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::absl-py-0.9.0-py36_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::libgfortran-ng-7.3.0-hdf63c60_0
  - defaults/linux-64::libgfortran-ng-7.3.0-hdf63c60_0, defaults/linux-64::libprotobuf-3.11.4-hd408876_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::_tflow_select-2.1.0-gpu, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::absl-py-0.9.0-py36_0
  - defaults/linux-64::_tflow_select-2.1.0-gpu, defaults/linux-64::libprotobuf-3.11.4-hd408876_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::absl-py-0.9.0-py36_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::libgfortran-ng-7.3.0-hdf63c60_0
  - defaults/linux-64::_tflow_select-2.1.0-gpu, defaults/linux-64::libgfortran-ng-7.3.0-hdf63c60_0, defaults/linux-64::libprotobuf-3.11.4-hd408876_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::absl-py-0.9.0-py36_0
  - defaults/linux-64::_tflow_select-2.1.0-gpu, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::absl-py-0.9.0-py36_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::libgfortran-ng-7.3.0-hdf63c60_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::libprotobuf-3.11.4-hd408876_0
  - defaults/linux-64::_tflow_select-2.1.0-gpu, defaults/linux-64::libgfortran-ng-7.3.0-hdf63c60_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::absl-py-0.9.0-py36_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::libprotobuf-3.11.4-hd408876_0
  - defaults/linux-64::_tflow_select-2.1.0-gpu, defaults/linux-64::absl-py-0.9.0-py36_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::libgfortran-ng-7.3.0-hdf63c60_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::libprotobuf-3.11.4-hd408876_0
  - defaults/linux-64::absl-py-0.9.0-py36_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::_tflow_select-2.1.0-gpu, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::libgfortran-ng-7.3.0-hdf63c60_0, https://repo.anaconda.com/pkgs/main/linux-64/linux-64::libprotobuf-3.11.4-hd408876_0
  ... and othedone

## Package Plan ##

  environment location: /home/ubuntu/miniconda3/envs/myenv

  added / updated specs:
    - librosa


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    qt-5.12.5                  |       hd8c4c69_1        99.2 MB  conda-forge
    ------------------------------------------------------------
                                           Total:        99.2 MB

The following NEW packages will be INSTALLED:

  audioread          conda-forge/linux-64::audioread-2.1.8-py36h9f0ad1d_2
  bzip2              conda-forge/linux-64::bzip2-1.0.8-h516909a_2
  ca-certificates    conda-forge/linux-64::ca-certificates-2019.11.28-hecc5488_0
  cffi               conda-forge/linux-64::cffi-1.14.0-py36hd463f26_0
  cycler             conda-forge/noarch::cycler-0.10.0-py_2
  dbus               conda-forge/linux-64::dbus-1.13.6-he372182_0
  decorator          conda-forge/noarch::decorator-4.4.2-py_0
  expat              conda-forge/linux-64::expat-2.2.9-he1b5a44_2
  ffmpeg             conda-forge/linux-64::ffmpeg-4.2-h167e202_0
  fontconfig         conda-forge/linux-64::fontconfig-2.13.1-h86ecdb6_1001
  freetype           conda-forge/linux-64::freetype-2.10.1-he06d7ca_0
  gettext            conda-forge/linux-64::gettext-0.19.8.1-hc5be6a0_1002
  glib               conda-forge/linux-64::glib-2.58.3-py36hd3ed26a_1003
  gmp                conda-forge/linux-64::gmp-6.2.0-he1b5a44_2
  gnutls             conda-forge/linux-64::gnutls-3.6.5-hd3a4fd2_1002
  gst-plugins-base   conda-forge/linux-64::gst-plugins-base-1.14.5-h0935bb2_2
  gstreamer          conda-forge/linux-64::gstreamer-1.14.5-h36ae1b5_2
  icu                conda-forge/linux-64::icu-64.2-he1b5a44_1
  joblib             conda-forge/noarch::joblib-0.14.1-py_0
  jpeg               conda-forge/linux-64::jpeg-9c-h14c3975_1001
  kiwisolver         conda-forge/linux-64::kiwisolver-1.1.0-py36hdb11119_1
  lame               conda-forge/linux-64::lame-3.100-h14c3975_1001
  ld_impl_linux-64   conda-forge/linux-64::ld_impl_linux-64-2.34-h53a641e_0
  libblas            conda-forge/linux-64::libblas-3.8.0-7_h6e990d7_netlib
  libcblas           conda-forge/linux-64::libcblas-3.8.0-7_h6e990d7_netlib
  libclang           conda-forge/linux-64::libclang-9.0.1-default_hde54327_0
  libffi             conda-forge/linux-64::libffi-3.2.1-he1b5a44_1007
  libflac            conda-forge/linux-64::libflac-1.3.3-he1b5a44_0
  libiconv           conda-forge/linux-64::libiconv-1.15-h516909a_1006
  liblapack          conda-forge/linux-64::liblapack-3.8.0-7_h6e990d7_netlib
  libllvm8           conda-forge/linux-64::libllvm8-8.0.1-hc9558a2_0
  libllvm9           conda-forge/linux-64::libllvm9-9.0.1-hc9558a2_0
  libogg             conda-forge/linux-64::libogg-1.3.2-h516909a_1002
  libpng             conda-forge/linux-64::libpng-1.6.37-hed695b0_1
  librosa            conda-forge/noarch::librosa-0.7.2-py_0
  libsndfile         conda-forge/linux-64::libsndfile-1.0.28-he1b5a44_1000
  libuuid            conda-forge/linux-64::libuuid-2.32.1-h14c3975_1000
  libvorbis          conda-forge/linux-64::libvorbis-1.3.6-hebb1f50_1
  libxcb             conda-forge/linux-64::libxcb-1.13-h14c3975_1002
  libxkbcommon       conda-forge/linux-64::libxkbcommon-0.10.0-he1b5a44_0
  libxml2            conda-forge/linux-64::libxml2-2.9.10-hee79883_0
  llvmlite           conda-forge/linux-64::llvmlite-0.31.0-py36hfa65bc7_1
  matplotlib         conda-forge/linux-64::matplotlib-3.2.1-0
  matplotlib-base    conda-forge/linux-64::matplotlib-base-3.2.1-py36hb8e4980_0
  ncurses            conda-forge/linux-64::ncurses-6.1-hf484d3e_1002
  nettle             conda-forge/linux-64::nettle-3.4.1-h1bed415_1002
  nspr               conda-forge/linux-64::nspr-4.25-he1b5a44_0
  nss                conda-forge/linux-64::nss-3.47-he751ad9_0
  numba              conda-forge/linux-64::numba-0.48.0-py36hb3f55d8_0
  openh264           conda-forge/linux-64::openh264-1.8.0-hdbcaa40_1000
  pcre               conda-forge/linux-64::pcre-8.44-he1b5a44_0
  pthread-stubs      conda-forge/linux-64::pthread-stubs-0.4-h14c3975_1001
  pycparser          conda-forge/noarch::pycparser-2.20-py_0
  pyparsing          conda-forge/noarch::pyparsing-2.4.6-py_0
  pyqt               conda-forge/linux-64::pyqt-5.12.3-py36hcca6a23_1
  pysoundfile        conda-forge/noarch::pysoundfile-0.10.2-py_1001
  python-dateutil    conda-forge/noarch::python-dateutil-2.8.1-py_0
  python_abi         conda-forge/linux-64::python_abi-3.6-1_cp36m
  qt                 conda-forge/linux-64::qt-5.12.5-hd8c4c69_1
  resampy            conda-forge/noarch::resampy-0.2.2-py_0
  scikit-learn       conda-forge/linux-64::scikit-learn-0.22.2.post1-py36hcdab131_0
  tornado            conda-forge/linux-64::tornado-6.0.4-py36h8c4c3a4_1
  x264               conda-forge/linux-64::x264-1!152.20180806-h14c3975_0
  xorg-libxau        conda-forge/linux-64::xorg-libxau-1.0.9-h14c3975_0
  xorg-libxdmcp      conda-forge/linux-64::xorg-libxdmcp-1.1.3-h516909a_0

The following packages will be UPDATED:

  certifi            anaconda/pkgs/free::certifi-2016.2.28~ --> conda-forge::certifi-2019.11.28-py36h9f0ad1d_1
  h5py               anaconda/pkgs/free::h5py-2.7.0-np113p~ --> conda-forge::h5py-2.10.0-nompi_py36h513d04c_102
  hdf5                    anaconda/pkgs/free::hdf5-1.8.17-2 --> conda-forge::hdf5-1.10.5-nompi_h3c11f04_1104
  numpy              pkgs/main::numpy-1.13.3-py36ha266831_3 --> conda-forge::numpy-1.18.1-py36h7314795_1
  openssl              anaconda/pkgs/free::openssl-1.0.2l-0 --> conda-forge::openssl-1.1.1e-h516909a_0
  python                 anaconda/pkgs/free::python-3.6.2-0 --> conda-forge::python-3.6.10-h9d8adfe_1009_cpython
  readline               anaconda/pkgs/free::readline-6.2-2 --> conda-forge::readline-8.0-hf8c457e_0
  scipy              anaconda/pkgs/free::scipy-0.19.1-np11~ --> conda-forge::scipy-1.4.1-py36h921218d_0
  sqlite                anaconda/pkgs/free::sqlite-3.13.0-0 --> conda-forge::sqlite-3.30.1-hcee41ef_0
  tk                        anaconda/pkgs/free::tk-8.5.18-0 --> conda-forge::tk-8.6.10-hed695b0_0
  xz                         anaconda/pkgs/free::xz-5.2.3-0 --> conda-forge::xz-5.2.4-h516909a_1002


Proceed ([y]/n)? y


Downloading and Extracting Packages
qt-5.12.5            | 99.2 MB   | ############################################################################################################################# | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

 

posted on 2020-03-24 19:23  你不知道的浪漫  阅读(8977)  评论(2编辑  收藏  举报