Installation librosa Timeout pip installation source disposed under ambient AnaConda

To reproduce the problem

We process installation package in AnaConda environment is sure to encounter the problem of slow download.

Timeout information is as follows (in order to facilitate everyone to find the information by time-out, at the expense of some pages experience, the exception message posted):

 conda.exceptions.CondaRuntimeError: Runtime error: Could not open '/home/ubuntu/anaconda3/pkgs/icu-64.2-he1b5a44_1.tar.bz2.part' 

for writing (HTTPSConnectionPool(host='conda.anaconda.org', port=443): Read timed out.). During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/conda/exceptions.py", line 473, in conda_exception_handler return_value = func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/conda/cli/main.py", line 144, in _main exit_code = args.func(args, p) File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/conda/cli/main_install.py", line 80, in execute install(args, parser, 'install') File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/conda/cli/install.py", line 422, in install raise CondaSystemExit('Exiting', e) File "/home/ubuntu/anaconda3/lib/python3.5/contextlib.py", line 77, in __exit__ self.gen.throw(type, value, traceback) File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/conda/cli/common.py", line 573, in json_progress_bars yield File "/home/ubuntu/anaconda3/lib/python3.5/site-packages/conda/cli/install.py", line 420, in install raise CondaRuntimeError('RuntimeError: %s' % e) conda.exceptions.CondaRuntimeError: Runtime error: RuntimeError: Runtime error: Could not open '/home/ubuntu/anaconda3/pkgs/icu-64.2-he1b5a44_1.tar.bz2.part'

for writing (HTTPSConnectionPool(host='conda.anaconda.org', port=443): Read timed out.).

 

Or as follows:

Fetching package metadata ...INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): mirrors.ustc.edu.cn
INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): mirrors.tuna.tsinghua.edu.cn
INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): mirrors.ustc.edu.cn
INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): repo.continuum.io
INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): mirrors.ustc.edu.cn
INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): mirrors.tuna.tsinghua.edu.cn
INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): mirrors.ustc.edu.cn
INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): repo.continuum.io
INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): conda.anaconda.org
INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): conda.anaconda.org
INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): mirrors.tuna.tsinghua.edu.cn
INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): mirrors.tuna.tsinghua.edu.cn
INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): mirrors.tuna.tsinghua.edu.cn
INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): mirrors.tuna.tsinghua.edu.cn
.INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): repo.continuum.io
.INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): repo.continuum.io
.........Could not connect to https://conda.anaconda.org/conda-forge/linux-64/
INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): conda.anaconda.org
..INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): mirrors.ustc.edu.cn
INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): mirrors.tuna.tsinghua.edu.cn
...INFO requests.packages.urllib3.connectionpool:_get_conn(249): Resetting dropped connection: mirrors.ustc.edu.cn
...INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (1): repo.continuum.io
WARNING requests.packages.urllib3.connectionpool:urlopen(664): Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after 
connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='repo.continuum.io', port=443): Read timed out. (read timeout=3.05)",)': /pkgs/free/linux-64/repodata.json.bz2 INFO requests.packages.urllib3.connectionpool:_new_conn(805): Starting new HTTPS connection (2): repo.continuum.io

Solution

The usual solution is to switch to domestic mirror source

The switch to conda USTC source, execute the command line

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels  https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/

pip switching source reference herein: pip installation source is provided

 But sometimes even switching the source, some pages because the network or the server downloads the reason is still slow, until a timeout occurs.

I recently downloaded librosa, execute the following command, final timeout can not download.

conda install librosa -c conda-forge

And later added a -v argument to view the execution order situation

conda install librosa -v -c conda-forge

It found that the situation had to perform overtime

 Later found the answer in stackoverflow above, AnaConda read timeout in version 4.3 The following are hard-coded into 60 seconds, this is clearly unreasonable.

I had the same issue. In conda < 4.3.0, the timeout was hardcoded to 60 seconds. In Windows, I'm guessing, that's not enough for huge package with a lot of binary

files like qt since most likely the virus scanner kicks in to check the files. You can hack your ~userid\AppData\Local\Continuum\Anaconda3\lib\site-packages\conda\fetch.py

and change the hard-coded constant yourself, eg. from 60 to 300.

With newer version (I'm not sure when this was added, but I see this in my conda 4.3.22), running conda config --show gave: remote_read_timeout_secs: 60.0.

So I believe you can modify it by adding it to your ~userid\.condarc file.

 

The author is a local version 4.2.0 Anaconda3-4.2.0-Linux-x86_64.sh

Try to execute the command given:

conda config --set remote_read_timeout_secs 3600

Error message:

ubuntu@ubuntu-B85-D3V:~$ conda config --set remote_read_timeout_secs 3600
CondaValueError: Value error: Error key must be one of add_binstar_token, update_dependencies, binstar_upload, 
always_copy, anaconda_upload, add_pip_as_python_dependency, allow_other_channels, channel_priority, changeps1, always_yes,
shortcuts, channel_alias, use_pip, auto_update_conda, add_anaconda_token, ssl_verify, client_cert_key, client_cert,
show_channel_urls, offline, allow_softlinks, not remote_read_timeout_secs

The current version is 4.2.0 does not support this remote_read_timeout_secs environment variable settings

I found a timeout relevant information on the latest version of the official documentation, you can use these two parameters, as appropriate, according to the actual situation:

Remote connection timeout (default 9.15 seconds)

# # remote_connect_timeout_secs (float)
# #   The number seconds conda will wait for your client to establish a
# #   connection to a remote url resource.
# # 
# remote_connect_timeout_secs: 9.15

Remote read timeout (default 60 seconds)

# # remote_read_timeout_secs (float)
# #   Once conda has connected to a remote resource and sent an HTTP
# #   request, the read timeout is the number of seconds conda will wait for
# #   the server to send a response.
# # 
# remote_read_timeout_secs: 60.0

 

in conclusion

AnaConda version upgrade or replace the mirror source

wget https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh
chmod +x Anaconda3-2019.10-Linux-x86_64.sh

Installation is simple, all the way round to

 

 

 

 

 

 

Configuration environment variable

vim ~/.bashrc
# added by Anaconda3 4.2.0 installer
export PATH="/home/ubuntu/anaconda3/bin:$PATH"
export CUDA_HOME=/usr/local/cuda-10.2
export PATH="$CUDA_HOME/bin:$PATH"
export LD_LIBRARY_PATH="$CUDA_HOME/lib64:$LD_LIBRARY_PATH"

 

参考来源:https://stackoverflow.com/questions/42797957/changing-timeout-limit-when-using-conda-install

https://docs.conda.io/projects/conda/en/latest/configuration.html

Guess you like

Origin www.cnblogs.com/passedbylove/p/12151491.html