NginxProxyManager / nginx-proxy-manager

Docker container for managing Nginx proxy hosts with a simple, powerful interface
https://nginxproxymanager.com
MIT License
22.05k stars 2.54k forks source link

pip install certbot-dns-aliyun timeout #3949

Open ykrank opened 3 weeks ago

ykrank commented 3 weeks ago

When restart NPM, will always recall pip install certbot-dns-aliyun~=0.38.1, but this command always timeout fail for several times. After 5 or more times retry, this will be success. I think the reason for this phenomenon is that the current network speed is too slow and the pip timeout time is too short (15seconds). So we need to add an environment variable to change the pip timeout time and add a proxy for pip.

raceback (most recent call last):
  File "/opt/certbot/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 180, in exc_logging_wrapper
    status = run_func(*args)
             ^^^^^^^^^^^^^^^
  File "/opt/certbot/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 245, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/certbot/lib/python3.11/site-packages/pip/_internal/commands/install.py", line 377, in run
    requirement_set = resolver.resolve(
                      ^^^^^^^^^^^^^^^^^
  File "/opt/certbot/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 179, in resolve
    self.factory.preparer.prepare_linked_requirements_more(reqs)
  File "/opt/certbot/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 552, in prepare_linked_requirements_more
    self._complete_partial_requirements(
  File "/opt/certbot/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 467, in _complete_partial_requirements
    for link, (filepath, _) in batch_download:
  File "/opt/certbot/lib/python3.11/site-packages/pip/_internal/network/download.py", line 183, in __call__
    for chunk in chunks:
  File "/opt/certbot/lib/python3.11/site-packages/pip/_internal/network/utils.py", line 63, in response_chunks
    for chunk in response.raw.stream(
  File "/opt/certbot/lib/python3.11/site-packages/pip/_vendor/urllib3/response.py", line 622, in stream
    data = self.read(amt=amt, decode_content=decode_content)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/certbot/lib/python3.11/site-packages/pip/_vendor/urllib3/response.py", line 560, in read
    with self._error_catcher():
  File "/usr/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/opt/certbot/lib/python3.11/site-packages/pip/_vendor/urllib3/response.py", line 443, in _error_catcher
    raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

[8/22/2024] [5:45:35 PM] [Global   ] › ✖  error     Some plugins failed to install. Please check the logs above

[8/22/2024] [5:45:36 PM] [Certbot  ] › ▶  start     Installing aliyun...
[8/22/2024] [5:45:36 PM] [Global   ] › ⬤  debug     CMD: . /opt/certbot/bin/activate && pip install --no-cache-dir  certbot-dns-aliyun~=0.38.1  && deactivate
[8/22/2024] [5:47:32 PM] [Certbot  ] › ☒  complete  Installed aliyun
Wanxp commented 1 week ago

I got this error too. Here is my resolve: Enter to docker container (If you use docker to run npm), change python pip repository to thirdparty mirror. BUT, I want developer can fix this bug or add config for to change python mirror in docker container. The reason most happened because the network error. In China consider the gfw , you should change pip repository mirror can fix this problem.

  1. enter docker container (If you use docker to run npm)
    docker exec -it  YOUR_CONTAINER_ID /bin/bash
  2. create pip config file
    mkdir ~/.pip/
    touch ~/.pip/pip.conf
  3. add mirror to pip config file
    
    cat > ~/.pip/pip.conf <<EOF
    > [global]
    index-url = https://pypi.tuna.tsinghua.edu.cn/simple

[install] trusted-host=mirrors.aliyun.com

EOF


4. retry for install